Skip to content

'Unexpected token import' occured after 'npm run dev' #3

@ryo22222

Description

@ryo22222
Mac OSX yosemite
Chrome

node v7.2.0
npm v4.0.5

I referred following Issue.
#1

And add .eslintrc.js

module.exports = {
  root: true,
  parserOptions: {
    sourceType: 'module'
  },
  // required to lint *.vue files
  plugins: [
    'html',
    'standard',
    'promise'
  ],
  // add your custom rules here
  'rules': {
    // allow debugger during development
    'no-debugger': process.env.NODE_ENV === 'production' ? 2 : 0
  }
}

After that, I run npm run dev

and compiled successfully.

> node build/dev-server.js

Listening at http://localhost:8080

webpack: wait until bundle finished: /index.html
webpack built b5dbe988506925b28459 in 3446ms
Hash: b5dbe988506925b28459
Version: webpack 1.14.0
Time: 3446ms
     Asset       Size  Chunks             Chunk Names
    app.js     287 kB       0  [emitted]  app
index.html  964 bytes          [emitted]
Child html-webpack-plugin for "index.html":
         Asset     Size  Chunks       Chunk Names
    index.html  1.47 MB       0
webpack: Compiled successfully.

But, error occuered following in javascript console

Uncaught SyntaxError: Unexpected token import
    at Object.<anonymous> (app.js:618)
    at __webpack_require__ (app.js:556)
    at fn (app.js:87)
    at Object.<anonymous> (app.js:587)
    at __webpack_require__ (app.js:556)
    at app.js:579
    at app.js:582

npm run build

when I run npm run build

following error occured

 npm run build

> node build/build.js

  Tip:
  Built files are meant to be served over an HTTP server.
  Opening index.html over file:// won't work.

Hash: 1ccb9afb33338d5ce485
Version: webpack 1.14.0
Time: 2468ms
                                         Asset       Size   Chunks             Chunk Names
    static/js/manifest.7e2e7c75c292958bd3ed.js  836 bytes     0, 2  [emitted]  manifest
         static/js/app.6d75d40efaf6ce0b7b0e.js    1.37 kB  1, 0, 2  [emitted]  app
      static/js/vendor.2044b1050eab4285dea0.js   79 bytes     2, 0  [emitted]  vendor
static/js/manifest.7e2e7c75c292958bd3ed.js.map     8.9 kB     0, 2  [emitted]  manifest
     static/js/app.6d75d40efaf6ce0b7b0e.js.map    2.74 kB  1, 0, 2  [emitted]  app
  static/js/vendor.2044b1050eab4285dea0.js.map  315 bytes     2, 0  [emitted]  vendor
                                    index.html  843 bytes           [emitted]

ERROR in static/js/app.6d75d40efaf6ce0b7b0e.js from UglifyJs
SyntaxError: Unexpected token: name (Vue) [./src/main.js:3,7]

Metadata

Metadata

Assignees

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