Created
July 2, 2017 06:11
-
-
Save movii/612f6ec63f39f2438897451f58f85835 to your computer and use it in GitHub Desktop.
笔记:Webpack 输出 UMD,extract-text-plugin 删除部分内容导致输出为空 - 8. 导致问题发生的 webpack 完整配置
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var webpack = require('webpack'); | |
var path = require('path'); | |
var ExtractTextPlugin = require("extract-text-webpack-plugin"); | |
module.exports = { | |
entry: { | |
moda: [ | |
'./src/moda.js', | |
'./src/moda.scss' | |
] | |
}, | |
output: { | |
filename: '[name].js', | |
path: path.resolve(__dirname, 'dist'), | |
library: 'moda', | |
libraryTarget: 'umd', | |
}, | |
module: { | |
rules: [ | |
{ | |
test: /.\css$/, | |
use: ['style-loader', 'css-loader'] | |
}, | |
{ | |
test: /\.scss$/, | |
use: ExtractTextPlugin.extract({ | |
use: ['css-loader', 'sass-loader'], | |
fallback: 'style-loader' | |
}) | |
}, | |
{ | |
test: /\.js$/, | |
loader: 'babel-loader', | |
exclude: /node_modules/ | |
} | |
] | |
}, | |
plugins: [ | |
new ExtractTextPlugin('moda.css') | |
] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment