目录
Webpack 2.2 中文文档
外部扩展配置(External Configurations)
webpack 允许使用任意语言定义配置文件。文件扩展支持列表 node-interpret 包中找到。webpack 将通过你选择的语言运行你的配置。
例如,如果你使用 coffeescript,你的文件将如下所示:
webpack.config.coffee
HtmlWebpackPlugin = require('html-webpack-plugin') webpack = require('webpack') path = require('path') config = entry: './path/to/my/entry/file.js' output: path: path.resolve(__dirname, 'dist') filename: 'my-first-webpack.bundle.js' module: rules: [ { test: /\.(js|jsx)$/ use: 'babel-loader' } ] plugins: [ new (webpack.optimize.UglifyJsPlugin) new HtmlWebpackPlugin(template: './src/index.html') ] module.exports = config
>> loader settings, e.g. sassLoader, eslint sections
原文:https://webpack.js.org/configuration/external-configs/
上一篇: 传递配置(Passing a Configuration) 下一篇: 入口和上下文(Entry and Context)