-
Notifications
You must be signed in to change notification settings - Fork 12k
Uncaught ReferenceError: require is not defined #2099
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
Comments
Can you try migrating your apps following the newer instructions? https://github.com/angular/angular-cli#webpack-update |
I still get the same problem in the log but suprisingly, the app works correctly... |
From what I understand the angular2-template-loader (a webpack loader) replaces the templateUrl/stylesUrl with template/styles using require to load the needed file. You will notice there is no .css/.html in the build directory other than index.html. Since the TypeScript compiler does not know "require" you get that error. An easy fix is to install types for node via Also if protractor is installed the issue does not appear as protractor depends on @types/node. |
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
Windows 10.
angular-cli: 1.0.0-beta.11-webpack.8
node: 6.3.1
os: win32 x64
do on your code? etc.
Migrated application from previous angular-cli to angular-cli@webpack,
Migrated application from angular2-rc4 to angular-rc5
more information.
VM627:11Uncaught ReferenceError: require is not defined(anonymous function) @ VM627:11e.exports @ scripts.4c654bc….bundle.js:1460 @ scripts.4c654bc….bundle.js:1__webpack_require__ @ inline.js:1888 @ scripts.4c654bc….bundle.js:1__webpack_require__ @ inline.js:1window.webpackJsonp @ inline.js:1(anonymous function) @ scripts.4c654bc….bundle.js:1
I'm trying to create a production bundle that will be served by nginx by doing
ng build --env=tst --target=production
Development environment working fine when using
ng serve
Snippet from my package.json
The text was updated successfully, but these errors were encountered: