Webpack不保存源图文件

时间:2017-01-09 16:05:31

标签: javascript webpack source-maps

我正在尝试使用webpack生成源图文件。奇怪的是,当我查看我的webpack控制台输出时,看起来它正在构建app.js.map。但是,当我查看my / dist文件夹时,app.js.map文件不在那里。知道可能会发生什么吗?

我的webpack配置文件:

const postcssPlugins = [
  variables,
  cssnext,
  autoprefixer,
  precss,
  nested,
  assets(assetOptions),
  rucksack(),
  lost,
  postcssFlexibility,
];

const entry = {
  app: [
    resolve(__dirname, '../../client/app.js'),
  ],
  vendors: [
    'redux',
    'react-redux',
    'react',
    'react-relay',
    'react-tap-event-plugin',
    'react-router-relay',
    'moment',
    'moment-timezone',
    'remarkable',
  ],
};

if (process.env.NODE_ENV === 'development') {
  entry.app.unshift(
    `webpack-dev-server/client?http://localhost:${process.env.PORT}`,
    'webpack/hot/only-dev-server'
  );
}

export default {
  entry,
  output: {
    filename: 'app.js',
    path: resolve('./dist'),
    publicPath: '/assets/',
    chunkFilename: '[id].chunk.js',
  },
  debug: true,
  devtool: 'source-map',
  exclude: [/bower_components/, /node_modules/],
  resolve: {
    alias,
  },
  module: {
    loaders: loaders(),
  },
  postcss: webpack => [
    postCSSImport({
      addDependencyTo: webpack,
    }),
    ...postcssPlugins,
  ],
  plugins: plugins(),
};

webpack控制台输出的屏幕截图(见app.js.map底部的第二个) enter image description here

0 个答案:

没有答案