webpack.config.js 982 B

1234567891011121314151617181920212223242526272829
  1. var path = require('path')
  2. var webpack = require('webpack')
  3. const WebpackMerge = require('webpack-merge')
  4. const baseConfig = require('./webpack.base.js')
  5. let HtmlWebpackPlugin = require('html-webpack-plugin');
  6. module.exports = WebpackMerge.merge(baseConfig, {
  7. mode: 'development',
  8. entry: path.join(__dirname, 'examples/main.js'), // 入口文件
  9. output: {
  10. path: path.join(__dirname, 'dist'), // 打包后文件存放的地方
  11. filename: 'dist/build.js' // 打包后输出的文件名
  12. },
  13. devServer: {
  14. port: 8086,
  15. historyApiFallback: true,
  16. },
  17. plugins: (module.exports.plugins || []).concat([
  18. new webpack.DefinePlugin({
  19. __VUE_OPTIONS_API__: false,
  20. __VUE_PROD_DEVTOOLS__: false,
  21. }),
  22. new HtmlWebpackPlugin({ // html-webpack-plugin 插件对象
  23. template: path.join(__dirname, './index.html'), // 指定模板文件
  24. filename: 'index.html' // 设置内存中的文件名
  25. })
  26. ])
  27. })