Skip to content

Fail to build when worker-loader is used #4773

Closed
@trimeyko

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 ?

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