问题描述
我已经购买了 this VUE template。从其文档中,如果我运行 npm run install && npm run dev
。看起来正确
当我执行 npm run build
以使我的生产就绪项目时。如您所见,它看起来不一样:
我检查了生成的 HTML 中的 css 链接,只有一个指向“文件”。我相信是正确的...(?)
这是vue.config.js
:
module.exports = {
publicPath: process.env.NODE_ENV === 'production' ? './' : './',outputDir: 'dist',assetsDir: 'app',indexPath: 'index.html',configureWebpack: {
devtool: 'source-map'
},}
我的 env.production
看起来像:
NODE_ENV=production
VUE_APP_TITLE=My Base Front End
- 我在配置文件中遗漏了什么?
解决方法
尝试在您的布局文件中为标记 stylesheet_pack_tag
添加以下代码:
<%= stylesheet_pack_tag 'application',media: 'all','data-turbolinks-track': 'reload' %>
我可以从过去的经验中回忆起类似的问题。