three.cad/webpack.common.js

48 lines
1.0 KiB
JavaScript
Raw Normal View History

2021-03-21 03:08:15 +08:00
const path = require('path');
2021-04-01 20:13:49 +08:00
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
const tailwindcss = require('tailwindcss')
2021-03-21 03:08:15 +08:00
module.exports = {
2021-03-29 05:34:55 +08:00
entry: {
2021-04-08 06:50:53 +08:00
app: './src/react/app.jsx',
2021-04-26 15:25:47 +08:00
scene: './src/Scene.js',
2021-03-29 05:34:55 +08:00
},
output: {
filename: '[name].bundle.js',
path: path.resolve(__dirname, 'dist'),
2021-04-26 16:22:13 +08:00
// clean: true,
2021-03-29 05:34:55 +08:00
},
2021-04-01 20:13:49 +08:00
plugins: [new MiniCssExtractPlugin()],
2021-03-21 03:08:15 +08:00
module: {
rules: [
{
2021-04-01 16:20:50 +08:00
test: /\.css$/i,
2021-04-01 20:13:49 +08:00
use: [
MiniCssExtractPlugin.loader,
'css-loader',
{
loader: 'postcss-loader',
options: {
postcssOptions: {
plugins: [tailwindcss],
},
},
},
],
2021-03-21 03:08:15 +08:00
},
2021-03-26 17:25:28 +08:00
{
test: /\.(js|jsx)$/,
exclude: /node_modules/,
use: {
loader: 'babel-loader',
options: {
2021-03-27 04:40:40 +08:00
presets: ["@babel/preset-react"],
2021-03-26 17:25:28 +08:00
}
}
},
2021-03-21 03:08:15 +08:00
],
},
2021-03-26 17:25:28 +08:00
resolve: {
2021-04-07 03:46:16 +08:00
extensions: ['.mjs', '.js', '.jsx', '*']
2021-03-27 04:40:40 +08:00
},
2021-04-01 20:13:49 +08:00
};