Answer the question
In order to leave comments, you need to log in
Webpack Unexpected token import/export?
const routerPaths = require('../src/router/public').default;
/ /unexpected token {, from import inside public.js
import { default as routerPaths } from '../src/router/public';
// unexpected token {
import ('../src/router/public');
// error, not supported
import { HOME, SEARCH, VIDEO } from '@/router/urls';
const paths = [
{
path: HOME,
name: 'home',
component: () => import('@/components/public/pages/home.vue'),
...
export default paths;
// ERROR! Unexpected token export
// export default paths;
^^^^^^
{
test: /\.vue$/,
loader: 'vue-loader',
options: {
loaders: {
scss: 'vue-style-loader!css-loader!sass-loader', // <style lang="scss">
sass: 'vue-style-loader!css-loader!sass-loader?indentedSyntax', // <style lang="sass">
},
},
},
{
test: /\.js$/,
use: 'source-map-loader',
exclude: /node_modules/,
},
// PROD
{
test: /\.js$/,
use: 'babel-loader',
exclude: /node_modules/,
},
"babel-core": "^6.26.3",
"babel-eslint": "^8.2.3",
"babel-loader": "^7.1.4",
"babel-plugin-transform-runtime": "^6.23.0",
"babel-preset-env": "^1.7.0",
"babel-preset-es2015": "^6.24.1",
"babel-preset-stage-2": "^6.24.1",
"webpack": "^4.20.2"
"plugins": [
"transform-runtime",
"dynamic-import-node",
"@babel/plugin-syntax-dynamic-import"
],
{
"presets": [
[
"env",
{
"modules": false,
"targets": {
"browsers": [
"> 1%",
"last 2 versions",
"not ie <= 8"
]
}
}
],
"stage-2"
],
"plugins": [
"transform-runtime"
],
"comments": false,
"env": {
"test": {
"presets": [
"es2015",
"env",
"stage-2"
],
"plugins": [
"istanbul"
]
}
}
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question