SyntaxError: Unexpected token import (import {AotPlugin} from '@ngtools/webpack')
See original GitHub issueBug Report or Feature Request (mark with an x
)
- [x ] bug report -> please search issues before submitting
- [ ] feature request
Versions.
npm -v 4.6.1
node -v v6.10.0
webpack version 3.4.1
Repro steps.
Following the documentation readme instructions, Adding this to webpack config file causes immediate compilation error
import {AotPlugin} from '@ngtools/webpack';
The log given by the failure.
import {AotPlugin} from '@ngtools/webpack'
^^^^^^
SyntaxError: Unexpected token import
at Object.exports.runInThisContext (vm.js:76:16)
at Module._compile (module.js:542:28)
at Object.Module._extensions..js (module.js:579:10)
at Module.load (module.js:487:32)
at tryModuleLoad (module.js:446:12)
at Function.Module._load (module.js:438:3)
at Module.require (module.js:497:17)
at require (internal/module.js:20:19)
Issue Analytics
- State:
- Created 6 years ago
- Comments:5 (1 by maintainers)
Top Results From Across the Web
Webpack: Unexpected token import - Stack Overflow
When I require the "html-webpack-plugin" , and exporting the object with "module.exports" it works fine but I'm trying to write this in ES6....
Read more >Upgrade Angular 4 app to Angular 5 with Visual Studio 2017
Webpack uses AotPlugin to compile the Angular 4 apps, now Webpack no longer uses Aotplugin for Angular 5. It now uses AngularCompilerPlugin.
Read more >Optimizing an Angular App with the AoT compilation
To do this, we used the webpack AotPlugin in the production configuration (which allows us ... SyntaxError: Unexpected token { at exports.
Read more >typescript syntaxerror: unexpected token 'export' - You.com
So the dependency in node_modules folder exports a function using ES6 import/export module. The code will throw error when it running in browser...
Read more >Webpack lesson - Uncaught SyntaxError: Unexpected token ...
Why do I get "Uncaught SyntaxError: Unexpected token import"? Compiling works ok.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Same problem. Changed it to require and then I get new AotPlugin({ ^ TypeError: AotPlugin is not a constructor
Ok but why doesn’t it say that clearly in the documentation page? Its too much to assume people will know this. Please update docs with this explanation. Thanks