webpack:AngularJS 1.6.1(ES6)和SCSS打包

时间:2017-02-03 10:59:19

标签: angularjs sass webpack ecmascript-6 angularjs-1.6

有人可以帮我配置webpack以满足以下要求

  • AngularJS(1.6)ES6至ES5转换
  • SCSS to CSS编译器
  • 所有js到单捆
  • 所有css到单捆
  • 所有文件夹结构都应该只用html创建(没有js文件,因为我们已经捆绑了它)

这是我到目前为止所尝试的

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

module.exports = {
    entry: path.resolve(__dirname, './app/app.module.js'),
    output: {
        path: path.resolve(__dirname, 'build'),
        filename: 'bundle.js'
    },
    module: {
        loaders: [{
            test: /\.js$/,
            loader: 'babel-loader',
            exclude: /node_modules/
        },
        { test: /\.scss$/, loader: 'style-loader!css-loader!sass-loader'},
        {
            test: /\.woff(\?v=\d+\.\d+\.\d+)?$/,
            loader: 'url?limit=10000&minetype=application/font-woff'
        },
        {
            test: /\.woff2$/,
            loader: 'url?limit=10000&minetype=application/font-woff'
        },
        {
            test: /\.ttf(\?v=\d+\.\d+\.\d+)?$/,
            loader: 'url?limit=10000&minetype=application/octet-stream'
        },
        {
            test: /\.eot(\?v=\d+\.\d+\.\d+)?$/,
            loader: 'file'
        },
        {
            test: /\.svg(\?v=\d+\.\d+\.\d+)?$/,
            loader: 'url?limit=10000&minetype=image/svg+xml'
        }
        ]
    },
    plugins: [
        //new ExtractTextPlugin("styles.css"),
    ]
};

1 个答案:

答案 0 :(得分:0)

更新了webpack conf

{{1}}
配置了webpack的

示例项目将其发布在我的github