首页 > 代码库 > webpack 1.x 之配置的坑

webpack 1.x 之配置的坑

一、静态资源目录改变(默认在dist下面)

默认:

webpack配置

  output: {
    path: path.join(__dirname, ‘./dist‘),
    filename: ‘build.js‘,
    chunkFilename: "[id].chunk.js",
    // publicPath: ‘/dist/‘,
  },

 

index.html中

技术分享

 

现在需要修改在dist下面,修改后:

webpack配置

  output: {
    path: path.join(__dirname, ‘./dist‘),
    filename: ‘build.js‘,
    chunkFilename: "[id].chunk.js",
    publicPath: ‘/dist/‘,
  },

index.html中

技术分享

 

 二、公共代码提取

技术分享

上为公共代码引入,下为公共代码提取

webpack 1.x 之配置的坑