Closed Olis-HL closed 3 years ago
How did you solve it in the end
@Olis-HL @lianwf also stuck on this, did you find any solution?
The problem seems to be the spread operator (...), so I tried updating my babel libs and including babel plugins: "@babel/plugin-transform-spread" "@babel/plugin-proposal-object-rest-spread"
but doesn't help
Hello,
Try to install the babel loader
npm install -D babel-loader @babel/core @babel/preset-env webpack
and add the rules to your webpack config file
module: {
rules: [
{
test: /\.m?js$/,
exclude: /(node_modules|bower_components)/,
use: {
loader: 'babel-loader',
options: {
presets: ['@babel/preset-env']
}
}
}
]
}
Yes, this is unrelated to this library, this is because you're not using the appropriate loaders https://github.com/nextcloud/viewer/blob/master/webpack.js#L11-L26
You also need to include it in the babel transpilling process
{
module: {
rules: [
...
{
// vue-plyr uses .mjs file
test: /\.m?js$/,
loader: 'babel-loader',
exclude: BabelLoaderExcludeNodeModulesExcept([
'vue-plyr',
]),
},
...
],
},
}
finally I solved this problem depends on the solution from @dcastrili @skjnldsv, with a little modification.
{ test: /\.mjs$/, loader: 'babel-loader', }
put this into the webpack rules instead of above if you are still struggling
As the others have stated above, this is an issue with your tooling, so I'll close this.
ERROR in ./node_modules/vue-plyr/dist/vue-plyr.mjs Module parse failed: Unexpected token (234:53) You may need an appropriate loader to handle this file type. | VuePlyr.install = (Vue, options = {}) => { | if (options.plyr) { | VuePlyr.props.options.default = () => { return { ...options.plyr } }; | }