Html VueJS“;“npm运行-构建”;不会在dist中创建索引文件
我想将我的VueJS应用程序部署到GitHub,但在运行“npm run build”后,dist文件夹中没有index.html文件: 此文件已存在于dist文件夹之外 你能帮我找到一个部署这个项目的解决方案吗 我的webpack.config.js如下所示:Html VueJS“;“npm运行-构建”;不会在dist中创建索引文件,html,vue.js,github,npm,webpack,Html,Vue.js,Github,Npm,Webpack,我想将我的VueJS应用程序部署到GitHub,但在运行“npm run build”后,dist文件夹中没有index.html文件: 此文件已存在于dist文件夹之外 你能帮我找到一个部署这个项目的解决方案吗 我的webpack.config.js如下所示: var path = require('path') var webpack = require('webpack') module.exports = { entry: './src/main.js', output
var path = require('path')
var webpack = require('webpack')
module.exports = {
entry: './src/main.js',
output: {
path: path.resolve(__dirname, './dist'),
publicPath: '/dist/',
filename: 'build.js'
},
module: {
rules: [
{
test: /\.css$/,
use: [
'vue-style-loader',
'css-loader'
],
}, {
test: /\.vue$/,
loader: 'vue-loader',
options: {
loaders: {
}
// other vue-loader options go here
}
},
{
test: /\.js$/,
loader: 'babel-loader',
exclude: /node_modules/
},
{
test: /\.(png|jpg|gif|svg)$/,
loader: 'file-loader',
options: {
name: '[name].[ext]?[hash]'
}
}
]
},
resolve: {
alias: {
'vue$': 'vue/dist/vue.esm.js'
},
extensions: ['*', '.js', '.vue', '.json']
},
devServer: {
historyApiFallback: true,
noInfo: true,
overlay: true
},
performance: {
hints: false
},
devtool: '#eval-source-map'
}
if (process.env.NODE_ENV === 'production') {
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
})
])
}
谢谢大家! 尝试更改:
path: path.resolve(__dirname, './dist'),
到
谢谢你的回答!我删除了dist文件夹,编辑了webpack.config.js文件,并再次创建了dist文件夹,但索引文件仍然不在其中。
path: path.resolve('./dist'),