加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
webpack.common.js 1.41 KB
一键复制 编辑 原始数据 按行查看 历史
const path = require('path')
const ExtractTextPlugin = require('extract-text-webpack-plugin')
const webpack = require('webpack')
var poststylus = require('poststylus')
module.exports = {
entry: {
bundle: path.join(path.resolve(__dirname), 'src/index.tsx')
},
module: {
rules: [
{
exclude: /node_modules/,
test: /\.tsx$/,
use: 'ts-loader'
},
{
exclude: /node_modules/,
test: /\.ts$/,
use: 'ts-loader'
},
{
exclude: /node_modules/,
test: /\.js$/,
use: ['babel-loader']
},
{
test: /\.styl$/,
use: ExtractTextPlugin.extract({
use: [
{
loader: 'css-loader'
},
{
loader: 'stylus-loader',
options: {
minimize: true
}
}
]
})
},
{
test: /\.css$/,
use: ExtractTextPlugin.extract({
fallback: 'style-loader',
use: 'css-loader'
})
}
]
},
resolve: {
extensions: ['.ts', '.tsx', '.js'],
modules: ['node_modules']
},
plugins: [
new webpack.LoaderOptionsPlugin({
test: /\.styl$/,
options: {
stylus: {
use: [poststylus(['autoprefixer'])]
}
}
}),
new ExtractTextPlugin({
filename: 'bundle.css',
allChunks: true
})
]
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化