webpack.config.js 982 B

1234567891011121314151617181920212223242526272829303132333435
  1. const {resolve} = require('path')
  2. const htmlWebpackPlugin = require('html-webpack-plugin')
  3. const webpack = require('webpack')
  4. const AddAssetHtmlWebpackPlugin = require('add-asset-html-webpack-plugin')
  5. module.exports = {
  6. entry: './src/index.js',
  7. output:{
  8. filename: 'built.js',
  9. path: resolve(__dirname,'build')
  10. },
  11. module:{
  12. rules:[
  13. ]
  14. },
  15. plugins:[
  16. new htmlWebpackPlugin({
  17. template: './src/index.html'
  18. }),
  19. //无需打包 动态连接
  20. new webpack.DllReferencePlugin({
  21. manifest: resolve(__dirname,'dll/manifest.json')
  22. }),
  23. //自动引入
  24. new AddAssetHtmlWebpackPlugin({
  25. filepath: resolve(__dirname,'dll/jquery.js'),
  26. // 文件输出目录
  27. outputPath: 'auto',
  28. // 脚本或链接标记的公共路径
  29. publicPath: 'auto'
  30. })
  31. ],
  32. mode:'production'
  33. }