加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
webpack.config.js 1.54 KB
一键复制 编辑 原始数据 按行查看 历史
jawidx 提交于 2019-04-03 21:21 . Update webpack.config.js
const path = require('path');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const CleanWebpackPlugin = require('clean-webpack-plugin');
module.exports = {
mode: 'development',
// devtool: 'inline-source-map',
target: 'web',
entry: {
demo: ['./examples/index.ts']
},
output: {
filename: '[name].[chunkhash].js',
path: path.resolve(__dirname, 'output'),
// publicPath: '/view'
},
plugins: [
new CleanWebpackPlugin(['output']),
new HtmlWebpackPlugin({
filename: 'demo.html',
template: './examples/index.html',
title: 'Demo Title',
// chunksSortMode: none
}),
],
resolve: {
extensions: ['*', '.js', '.jsx', '.ts', '.tsx']
},
module: {
rules: [
{
test: /\.(js|jsx|ts|tsx)$/,
include: path.resolve(__dirname, 'src'),
use: [
{
loader: 'babel-loader',
options: {
presets: ['@babel/env'],
}
},
'ts-loader'
]
},
{
test: /\.(html)$/,
use: {
loader: 'html-loader',
}
},
{
test: /\.(css|less)$/,
use: [
'css-loader',
'less-loader'
]
},
]
}
};
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化