-
Notifications
You must be signed in to change notification settings - Fork 359
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
Vue.js + vuex: Module parse failed: Unexpected character '#' #4778
Comments
Your bundler does not support private fields, see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes/Private_class_fields additionally it also doesn’t seem to support import.meta while including the ESM version - a solution may be https://polkadot.js.org/docs/usage/FAQ#on-webpack-4-i-have-a-parse-error-on-importmetaurl none of this is API related, rather the bundler not supporting ESM constructs. |
Thanks @jacogr - I agree the issue is not with the api per se. |
With help from @jacogr's comment I was able to track down a solution. This module.exports = {
configureWebpack: {
module: {
rules: [
{
test: /\.js$/,
// test: /node_modules[/\\]@polkadot*.js$/,
loader: require.resolve('@open-wc/webpack-import-meta-loader'),
// loader: '@open-wc/webpack-import-meta-loader',
exclude: /\.vue$/,
},
{
test: /\.m?js$/,
include: /node_modules[/\\|]@polkadot/i,
// exclude: /(node_modules|bower_components)/,
use: {
loader: 'babel-loader',
options: {
presets: [
'@babel/preset-env',
'@vue/cli-plugin-babel/preset',
],
plugins: [
"@babel/plugin-proposal-private-methods",
"@babel/plugin-proposal-class-properties",
'@babel/plugin-proposal-object-rest-spread',
]
}
}
},
]
}
},
} |
I had the exact same issue! Thanks heaps for documenting the fix! 💚 |
This issue has been open for 21 days with no activity and is not labelled as an enhancement. It will be closed in 7 days. |
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue if you think you have a related problem or query. |
I am developing a Brave / Chrome extension using Vue.js. I used this article to get started.
Now I'm trying to use Vuex to connect the @polkadot/api
@vue/cli 4.5.15
npm 8.5.5
store/modules/polkadot.js
I can't get the project to
build
It seems webpack cant handle the
#
hash characterIs there a loader I should add to handle this?
I tried various options in
vue.config.js
The text was updated successfully, but these errors were encountered: