Switch to webpack

This commit is contained in:
ochafik 2023-03-25 19:30:34 +00:00
commit 4b11073437
17 changed files with 238 additions and 69 deletions

49
webpack.config.js Normal file
View file

@ -0,0 +1,49 @@
const CopyPlugin = require("copy-webpack-plugin");
const path = require('path');
module.exports = {
entry: './src/index.tsx',
devtool: 'inline-source-map',
module: {
rules: [
{
test: /\.tsx?$/,
use: 'ts-loader',
exclude: /node_modules/,
},
{
test: /\.css$/i,
use: [
{loader: 'css-loader', options:{url: false}}
]
}
],
},
resolve: {
extensions: ['.tsx', '.ts', '.js'],
},
output: {
filename: 'index.js',
path: path.resolve(__dirname, 'dist'),
},
devServer: {
static: path.join(__dirname, "dist"),
compress: true,
port: 4000,
},
plugins: [
new CopyPlugin({
patterns: [
{
from: path.resolve(__dirname, 'public'),
toType: 'dir',
},
{
from: path.resolve(__dirname, 'src/wasm/openscad.js'),
from: path.resolve(__dirname, 'src/wasm/openscad.wasm'),
},
],
}),
],
};