Skip to content

Fail to build when worker-loader is used #4773

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
trimeyko opened this issue Feb 17, 2017 · 2 comments
Closed

Fail to build when worker-loader is used #4773

trimeyko opened this issue Feb 17, 2017 · 2 comments

Comments

@trimeyko
Copy link

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 ?

@filipesilva
Copy link
Contributor

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

@angular-automatic-lock-bot
Copy link

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.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 6, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants