如何配置Webpack DevTools工作区?

时间:2016-09-13 00:40:41

标签: webpack

如何配置Webpack DevTools工作区? 最近我开始开发一个Webpack。

在编译之前已经通过ruby(控制台),并通过开发工具Chrome Canary,SCSS / CSS文件和源图文件保存在本地,并进行了更新。 屏幕开发工具Chrome: prntscr.com/cgxr6z

问题: 我们需要一个详细的动作算法。 如何使开发工具Canary,立即显示SCSS / JS文件的更改而不是整页重新加载后?

感谢您的帮助)

配置webpack:

var webpack = require('webpack');
var path = require('path');
var ExtractTextPlugin = require("extract-text-webpack-plugin");

var plugins = [];

var production = false;

if (production) {
  plugins.push(
    new webpack.optimize.UglifyJsPlugin({
      compress: {
        warnings: false
      }
    })
  );
}

plugins.push(
  new ExtractTextPlugin(
    path.join(
      '..', 'css', 'theme.css'
    )
  )
);

module.exports = {
  entry: [
    './js/theme.js'
  ],
  output: {
    path: '../assets/js',
    filename: 'theme.js'
  },
  module: {
    loaders: [{
      test: /\.js$/,
      exclude: /node_modules/,
      loaders: ['babel-loader']
    }, {
      test: /\.scss$/,
      loader: ExtractTextPlugin.extract(
        "style",
        "css?sourceMap!postcss!sass?sourceMap"
      )
    }, {
      test: /.(png|woff(2)?|eot|ttf|svg)(\?[a-z0-9=\.]+)?$/,
      loader: 'file-loader?name=../css/[hash].[ext]'
    }, {
      test: /\.css$/,
      loader: "style-loader!css-loader!postcss-loader"
    }]
  },
  postcss: function() {
    return [require('postcss-flexibility')];
  },
  externals: {
    prestashop: 'prestashop'
  },
  debug: true,
  devtool: 'inline-source-map',
  plugins: plugins,
  resolve: {
    extensions: ['', '.js', '.scss']
  }
};

0 个答案:

没有答案