Skip to content
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

Cannot load any css and js file after build? #360

Closed
HenryYong opened this issue Feb 17, 2017 · 2 comments
Closed

Cannot load any css and js file after build? #360

HenryYong opened this issue Feb 17, 2017 · 2 comments

Comments

@HenryYong
Copy link

HenryYong commented Feb 17, 2017

I am using koa2 as backend and koa-swig to render my page. Here is the structure:
image

Inside dist file, there are index.html and static. All css, js, and images are in there. And here is the error:
image

Here is the build setting in config/index.js:
build: {
env: require('./prod.env'),
index: path.resolve(__dirname, '../dist/index.html'),
assetsRoot: path.resolve(__dirname, '../dist'),
assetsSubDirectory: 'static',
assetsPublicPath: '/',
productionSourceMap: true,
// Gzip off by default as many popular static hosts such as
// Surge or Netlify already gzip all static assets for you.
// Before setting to true, make sure to:
// npm install --save-dev compression-webpack-plugin
productionGzip: false,
productionGzipExtensions: ['js', 'css'],
// Run the build command with an extra argument to
// View the bundle analyzer report after build finishes:
// npm run build --report
// Set to true or false to always turn it on or off
bundleAnalyzerReport: process.env.npm_config_report
}

@HenryYong HenryYong changed the title Cannot load any css and js Cannot load any css and js file after build? Feb 17, 2017
@egoist
Copy link
Collaborator

egoist commented Feb 17, 2017

Support questions are better asked on Gitter/Forum/Stack Overflow.

Bug report please open issue in relevant repo.

@egoist egoist closed this as completed Feb 17, 2017
@zhangbiggs
Copy link

solution/issue179希望能帮到你

这个问题的原因出于引人css在webpack打包后,资源引人的路径与打包后的路径不同造成,style-loder 无法自己设置publicpath, 所以修改在ExtractTextPlugin后的css目录路径 ,或者css引人不提取到合并的css中


Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants