by https://github.com/nuxt/nuxt.js/issues/1162,
I provided fully resolved path to plugins then, nuxt build is ok!
but I think the files in plugins/
is not compiled by babel-loader.
Nuxt.js Error:
/path/to/project/plugins/apollo.js:1
(function (exports, require, module, __filename, __dirname) { import ApolloClient, { createNetworkInterface } from 'apollo-client'
SyntaxError: Unexpected token import
...
...
There is a import
keyword.
This is maybe not a problem about plugins/
, .
Error occur in default middleware.
{
...
plugins: [
'./plugins/element-ui',
'./plugins/vue-apollo',
{
src: './plugins/custom-element',
ssr: false,
},
{
src: './plugins/https-redirection',
ssr: false,
},
'./plugins/getProjectVersion',
],
router: {
middleware: 'default',
}
}
1: import { networkInterface } from '~/plugins/apollo'
2: ...
3: ...
If I change the error line, '~/plugins/apollo'
=> '../plugins/apollo'
,
then error message is changed to below.
Error: Cannot find module 'es6-promise/auto' from '/path/to/project'
at Function.module.exports [as sync] (/path/to/project/node_modules/resolve/lib/sync.js:40:15)
at r (/path/to/project/node_modules/vue-server-renderer/build.js:7741:44)
at Object.<anonymous> (webpack:/external "es6-promise/auto":1:0)
at __webpack_require__ (webpack:/webpack/bootstrap b13c1d9e6771c0e8f306:25:0)
at Object.<anonymous> (.nuxt/index.js:1:0)
at __webpack_require__ (webpack:/webpack/bootstrap b13c1d9e6771c0e8f306:25:0)
at Object.<anonymous> (.nuxt/server.js:6:0)
at __webpack_require__ (webpack:/webpack/bootstrap b13c1d9e6771c0e8f306:25:0)
at server-bundle.js:92:18
at Object.<anonymous> (server-bundle.js:95:10)
at evaluateModule (/path/to/project/node_modules/vue-server-renderer/build.js:7747:21)
at /path/to/project/node_modules/vue-server-renderer/build.js:7805:18
at /path/to/project/node_modules/vue-server-renderer/build.js:7797:14
at Object.renderToString (/path/to/project/node_modules/vue-server-renderer/build.js:7951:9)
at P (/path/to/project/node_modules/nuxt/node_modules/pify/index.js:49:6)
at Object.<anonymous> (/path/to/project/node_modules/nuxt/node_modules/pify/index.js:11:9)
at Object.ret [as renderToString] (/path/to/project/node_modules/nuxt/node_modules/pify/index.js:72:32)
at Renderer._callee7$ (/path/to/project/node_modules/nuxt/lib/core/renderer.js:325:41)
at tryCatch (/path/to/project/node_modules/nuxt/node_modules/regenerator-runtime/runtime.js:65:40)
at Generator.invoke [as _invoke] (/path/to/project/node_modules/nuxt/node_modules/regenerator-runtime/runtime.js:303:22)
at Generator.prototype.(anonymous function) [as next] (/path/to/project/node_modules/nuxt/node_modules/regenerator-runtime/runtime.js:117:21)
at step (/path/to/project/node_modules/nuxt/dist/nuxt.js:851:30)
at /path/to/project/node_modules/nuxt/dist/nuxt.js:869:14
at Renderer.<anonymous> (/path/to/project/node_modules/nuxt/dist/nuxt.js:848:12)
at Renderer.renderRoute (/path/to/project/node_modules/nuxt/dist/nuxt.js:2289:22)
at Renderer._callee5$ (/path/to/project/node_modules/nuxt/lib/core/renderer.js:225:69)
at tryCatch (/path/to/project/node_modules/nuxt/node_modules/regenerator-runtime/runtime.js:65:40)
at Generator.invoke [as _invoke] (/path/to/project/node_modules/nuxt/node_modules/regenerator-runtime/runtime.js:303:22)
at Generator.prototype.(anonymous function) [as next] (/path/to/project/node_modules/nuxt/node_modules/regenerator-runtime/runtime.js:117:21)
at step (/path/to/project/node_modules/nuxt/dist/nuxt.js:851:30)
at /path/to/project/node_modules/nuxt/dist/nuxt.js:869:14
at Renderer.<anonymous> (/path/to/project/node_modules/nuxt/dist/nuxt.js:848:12)
at Renderer.nuxtMiddleware (/path/to/project/node_modules/nuxt/dist/nuxt.js:2131:22)
at call (/path/to/project/node_modules/connect/index.js:239:7)
at next (/path/to/project/node_modules/connect/index.js:183:5)
at SendStream.error (/path/to/project/node_modules/serve-static/index.js:121:7)
at emitOne (events.js:96:13)
at SendStream.emit (events.js:191:7)
at SendStream.error (/path/to/project/node_modules/serve-static/node_modules/send/index.js:282:17)
at SendStream.onStatError (/path/to/project/node_modules/serve-static/node_modules/send/index.js:433:12)
at next (/path/to/project/node_modules/serve-static/node_modules/send/index.js:771:28)
at /path/to/project/node_modules/serve-static/node_modules/send/index.js:779:23
at FSReqWrap.oncomplete (fs.js:114:15)
This project don't have es6-promise/auto. (this is maybe in nuxt)
And My working pervious nuxt version is 1.0.0-alpha1
.