Skip to content

Instantly share code, notes, and snippets.

@movii
Created July 2, 2017 06:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save movii/612f6ec63f39f2438897451f58f85835 to your computer and use it in GitHub Desktop.
Save movii/612f6ec63f39f2438897451f58f85835 to your computer and use it in GitHub Desktop.
笔记:Webpack 输出 UMD,extract-text-plugin 删除部分内容导致输出为空 - 8. 导致问题发生的 webpack 完整配置
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