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
npm run build: Change publicPath from '/dist/' to './dist/' ? #71
Comments
maybe you can try this, if (process.env.NODE_ENV === 'production') {
// change publicPath to './dist/' when env is production
module.exports.output.publicPath = './dist/'
module.exports.devtool = '#source-map'
// http://vue-loader.vuejs.org/en/workflow/production.html
module.exports.plugins = (module.exports.plugins || []).concat([
new webpack.DefinePlugin({
'process.env': {
NODE_ENV: '"production"'
}
}),
new webpack.optimize.UglifyJsPlugin({
sourceMap: true,
compress: {
warnings: false
}
}),
new webpack.LoaderOptionsPlugin({
minimize: true
})
]) |
@zcong1993 Tested, it works, thanks! |
thanks |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I've started a thread about this on Vue-forum: https://forum.vuejs.org/t/vue-cli-webpack-production-images-vis-icons-are-not-loaded-where-to-import-css/6647/3
I am using Vue-cli [Webpack] and I have installed Vis.js. In App.vue I have added (imported) vis.css:
When I run
npm run dev
- everything works fine, all Vis icons are loaded (displayed), but when I runnpm run build
- when I open the app in the browser - Vis icons are missing and I am getting the following errors:In webpack.config.js when I changed
publicPath
from'/dist/'
to'./dist/'
- after running thenpm run build
command, everything works fine.Now, I'm not sure whether it is a good idea to have
publicPath: './dist/'
by default when we are running only thenpm run build
command (and when we runnpm run dev
- then it should be just'/dist/'
).The text was updated successfully, but these errors were encountered: