Skip to content
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

ERROR in ./src/router/index.js 39:13 Module parse failed: Unexpected token #1654

Open
richardhector opened this issue Mar 1, 2019 · 3 comments

Comments

@richardhector
Copy link

Hi all, I'm getting the below issue when running 'npm run build:prod' can anyone helpe`

`ERROR in ./src/router/index.js 39:13
Module parse failed: Unexpected token (39:13)
You may need an appropriate loader to handle this file type.
| path: '/redirect/:path',
| component: function component() {

  return import('@/views/redirect/index');

| }
| }]
@ ./src/main.js 15:0-30 47:10-16

Build failed with errors.

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! automater-frontent@0.0.1 build: cross-env NODE_ENV=production env_config=prod node build/build.js
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the automater-frontent@0.0.1 build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:`

@Silom
Copy link

Silom commented Mar 1, 2019

It appears the .babelrc configuration only allows development to use import, this might need a fix or a good explanation of why that is perhaps.
Fact is on master if you run npm run build, it will crash.

@woshidamaomao
Copy link

woshidamaomao commented Mar 18, 2019

Me too. The item had thrown an error same writer when I updated webpack to 4.0 .

@AJhinChen
Copy link

It appears the .babelrc configuration only allows development to use import, this might need a fix or a good explanation of why that is perhaps.
Fact is on master if you run npm run build, it will crash.

you are right. add the "plugins": ["dynamic-import-node"] to the production of .babelrc. it's work now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants