ObjToSchematic/webpack.common.js

54 lines
1.4 KiB
JavaScript
Raw Normal View History

2023-02-11 08:53:27 +08:00
const path = require('path');
const NodePolyfillPlugin = require('node-polyfill-webpack-plugin');
2023-03-02 02:06:13 +08:00
const HtmlWebpackPlugin = require('html-webpack-plugin');
2023-02-11 08:53:27 +08:00
module.exports = {
2023-03-28 00:45:56 +08:00
entry: './src/main.ts',
2023-02-11 08:53:27 +08:00
plugins: [
new NodePolyfillPlugin(),
2023-03-02 02:06:13 +08:00
new HtmlWebpackPlugin({
template: './template.html',
favicon: './res/static/icon.ico',
}),
2023-02-11 08:53:27 +08:00
],
module: {
rules: [
{
test: /\.worker.ts$/,
use: [
'worker-loader',
'ts-loader',
],
},
2023-02-11 08:53:27 +08:00
{
test: /\.css$/i,
use: ['style-loader', 'css-loader'],
exclude: /node_modules/,
2023-02-11 08:53:27 +08:00
},
{
test: /\.vs|fs|atlas$/,
2023-02-11 08:53:27 +08:00
use: 'raw-loader',
exclude: /\.js$/,
exclude: /node_modules/,
2023-02-11 08:53:27 +08:00
},
2023-02-12 05:29:36 +08:00
{
test: /\.png$/,
use: 'file-loader',
exclude: /node_modules/,
2023-02-12 05:29:36 +08:00
},
2023-02-11 08:53:27 +08:00
{
test: /\.tsx?$/,
use: 'ts-loader',
2023-03-28 00:45:56 +08:00
exclude: /node_modules/,
2023-02-11 08:53:27 +08:00
},
],
},
resolve: {
extensions: ['.tsx', '.ts', '.js'],
},
output: {
filename: 'bundle.js',
path: path.resolve(__dirname, './webpack'),
},
};