-
-
Notifications
You must be signed in to change notification settings - Fork 836
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
Why "main" in Package.json is "src/index.js" and not "dist/vue-chartjs.js" #53
Comments
Hello @Shaharking
Well I changed the entry point to The dist file, is a bundled file, where chart.js and vue.js got bundled into a module. Which also caused sometimes errors, because vue-chartjs would run into it own vue.js instance. So you would basically have two versions of vue running, the one which is bundled into the The dist file, actually would be only usefull, if you would load it directly in your browser. |
-The error that got thrown was: How do i make webpack compile the src files before importing them? |
Do you have a webpack config generated by vue-cli or a custom one? The problem seems to be related to you loaders. |
|
Can you post your package.json ? So I can see which babel version you got etc. ? It may be nessasary that you add babel-presets to your config and maybe include the node_modules folder. I think in webpack 2 they are not excluded anymore. That may be the reason why I had no problems with the current vue-cli webpack config. Temporary fix would be to import from the dist |
packages.json
.babelrc
|
Seems that only webpack 2 has native es6 module support. It looks like that for webpack 1 you need a commonjs build. However I am not a webpack pro 🙈 So I would guess, you should go with the alias method and create an alias to the bundled dist file. Unless you find a better workaround. btw. I guess you have node 6 +? |
It's fixed with There is a fallback to the umd module for older build system. However if you encounter problems with two vue instances, you can directly import the es version of use an alias.
|
Hey,
I had problem my app didn't work because my webpack didn't compile the libary in node_modules,
by changing your Package.json main property value from "src/index.js" to "dist/vue-chartjs.js"
it started back to work.
My question why you would do something like this?
The text was updated successfully, but these errors were encountered: