webpack.config.js 764 B

1234567891011121314151617181920212223242526272829303132
  1. const path = require("path")
  2. // node写法
  3. module.exports = {
  4. // development 开发
  5. // production 生产
  6. // mode: 'production',
  7. // entry: "./demo.js"
  8. // entry: ['./src/a.js', './demo.js']
  9. // entry: {
  10. // hi: './src/a.js',
  11. // hello: './src/b.js'
  12. // }
  13. entry: './src/a.js',
  14. // output: {
  15. // filename: 'xxx.js',
  16. // clean: true,
  17. // path: path.resolve(__dirname, 'news')
  18. // }
  19. module: {
  20. rules: [
  21. {
  22. test: /\.css$/i,
  23. use: ['style-loader', 'css-loader'],
  24. },
  25. {
  26. test: /\.(png|svg|jpg|jpeg|gif)$/i,
  27. type: 'asset/resource',
  28. },
  29. ],
  30. }
  31. }
  32. // 打包命令:yarn webpack