Skip to content

Instantly share code, notes, and snippets.

@movii

movii/moda.js

Created Jul 2, 2017
Embed
What would you like to do?
笔记:Webpack 输出 UMD,extract-text-plugin 删除部分内容导致输出为空 - 9. 不会出现问题的 webpack 完整配置
// 同时直接在 moda.js 直接引入 moda.scss
require('./moda.scss');
function ModA () {
this.identifier = 'ModA';
}
// ...
var webpack = require('webpack');
var path = require('path');
var ExtractTextPlugin = require("extract-text-webpack-plugin");
module.exports = {
entry:'./src/moda.js',
output: {
filename: 'moda.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')
],
devServer: {
compress: true,
port: 1333,
publicPath: '/dist/'
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.