-
-
Notifications
You must be signed in to change notification settings - Fork 6.3k
Description
Use the webpack template.
Issue: I modified the assetsPublicPath option in config.js when to built my project, it's run properly.
but when I run dev agian, the page "can not get" appears.
So I find the cause. If the assetsPublicPath change from '/' to others, the dev server can not find the
rootpath when npm run dev. Then I add a option in config.js
dev: {
assetsPublicPath:'/',
port: 8080,
proxyTable: {}
}
and modify dev-server.js
var staticPath = path.posix.join( config.dev.assetsPublicPath, config.build.assetsSubDirectory)
finally modify webpack.base.conf.js
output: {
path: config.build.assetsRoot,
publicPath: process.env.NODE_ENV === 'production' ? config.build.assetsPublicPath : config.dev.assetsPublicPath ,
filename: '[name].js'
}
So, I do not have to modify assetsPublicPath option after npm run build every time.