2 Star 5 Fork 2

tbhuabi/textbus

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
webpack.config.js 2.50 KB
一键复制 编辑 原始数据 按行查看 历史
tbhuabi 提交于 2023-02-24 01:54 . chore: 优化构建流程
const HtmlWebpackPlugin = require('html-webpack-plugin')
const path = require('path')
const EslintWebpackPlugin = require('eslint-webpack-plugin')
const ip = require('ip')
module.exports = {
mode: 'development',
devtool: 'cheap-module-source-map',
entry: {
index: path.resolve(__dirname, 'index.ts')
},
output: {
path: path.resolve(__dirname, 'dist'),
},
resolve: {
extensions: ['.ts', '.tsx', '.js'],
alias: {
'@textbus/core$': path.resolve(__dirname, './packages/core/src/public-api.ts'),
'@textbus/core/jsx-runtime': path.resolve(__dirname, './packages/core/jsx-runtime'),
'@textbus/platform-browser': path.resolve(__dirname, './packages/platform-browser/src/public-api.ts'),
'@textbus/editor$': path.resolve(__dirname, './packages/editor/src/public-api.ts'),
'@textbus/collaborate$': path.resolve(__dirname, './packages/collaborate/src/public-api.ts'),
}
},
devServer: {
host: ip.address(),
static: {
directory: path.join(__dirname, 'dist')
},
compress: true,
port: 8888,
hot: true,
open: true
},
module: {
rules: [{
test: /\.tsx?$/,
use: [{
loader: 'ts-loader',
options: {
configFile: path.resolve(__dirname, './tsconfig-dev.json')
}
}]
}, {
test: /\.s?css$/,
exclude: [path.resolve(__dirname, './packages/editor/src/components')],
use: ['style-loader', 'css-loader', {
loader: 'postcss-loader',
options: {
postcssOptions: {
plugins: [
[
'postcss-preset-env',
{
// Options
},
],
[
'autoprefixer'
]
],
}
}
}, 'sass-loader'],
}, {
test: /\.s?css$/,
include: [path.resolve(__dirname, './packages/editor/src/components')],
use: ['to-string-loader', 'css-loader', {
loader: 'postcss-loader',
options: {
postcssOptions: {
plugins: [
[
'postcss-preset-env',
{
// Options
},
],
[
'autoprefixer'
]
],
}
}
}, 'sass-loader'],
}]
},
plugins: [
new EslintWebpackPlugin({
extensions: ['.ts', '.tsx'],
exclude: [
'./test'
]
}),
new HtmlWebpackPlugin({
template: 'index.html'
})
]
}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
TypeScript
1
https://gitee.com/tbhuabi/textbus.git
git@gitee.com:tbhuabi/textbus.git
tbhuabi
textbus
textbus
master

搜索帮助

D67c1975 1850385 1daf7b77 1850385