Skip to content

Fail to build when worker-loader is used #4773

Closed

Description

@trimeyko

OS?

Windows 10

Versions.

@angular/cli: 1.0.0-beta.32.3 (e)
node: 7.5.0
os: win32 x64
@angular/common: 2.4.7
@angular/compiler: 2.4.7
@angular/core: 2.4.7
@angular/forms: 2.4.7
@angular/http: 2.4.7
@angular/platform-browser: 2.4.7
@angular/platform-browser-dynamic: 2.4.7
@angular/router: 3.4.7
@angular/cli: 1.0.0-beta.32.3
@angular/compiler-cli: 2.4.7

Repro steps.

  1. create new project using ng new
  2. npm install worker-loader
  3. create some typescript file (test.ts) and require it using worker-loader, for example in app.component.ts:

let Worker = require('worker-loader!./test.ts');

and try to create it in constructor:

constructor() {
const worker = new Worker();
}

The log given by the failure.

Uncaught Error: Module build failed: TypeError: Cannot read property 'newLine' of undefined
at Object.getNewLineCharacter (E:\project\upd\node_modules\typescript\lib\typescript.js:8062:20)
at Object.createCompilerHost (E:\project\upd\node_modules\typescript\lib\typescript.js:44978:26)
at Object.ngcLoader (E:\project\upd\node_modules@ngtools\webpack\src\loader.js:350:33)

Mention any other details that might be useful.

Worked before cli switched to own ts loader, works fine when override loaders in require with own ts-loader like "require('!!worker-loader!ts-loader!./test.ts')" until required file has some imports which is loaded using cli loader again, probably any way to override inner requires globally on worker-loader require ?

What's expected solution to load worker files using cli ?

Activity

  1. filipesilva commented on Feb 17, 2017

    @filipesilva
    Contributor

    Using loaders explicitly is not a supported usecase for the CLI and we provide no guarantee it will work.

  2. angular-automatic-lock-bot commented on Sep 6, 2019

    @angular-automatic-lock-bot

    This issue has been automatically locked due to inactivity.
    Please file a new issue if you are encountering a similar or related problem.

    Read more about our automatic conversation locking policy.

    This action has been performed automatically by a bot.

  3. locked and limited conversation to collaborators on Sep 6, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions