organic_ast_explorer/webpack.common.js

85 lines
1.6 KiB
JavaScript
Raw Normal View History

2024-01-21 22:54:00 +00:00
const HtmlWebpackPlugin = require("html-webpack-plugin");
const path = require("path");
2024-01-22 01:55:09 +00:00
const CSSModuleLoader = {
2024-01-22 02:11:38 +00:00
loader: "css-loader",
options: {
importLoaders: 2,
2024-01-24 03:06:47 +00:00
sourceMap: true,
modules: {
localIdentName: "[name]_[local]_[hash:base64:5]",
},
2024-01-22 02:11:38 +00:00
},
2024-01-22 01:55:09 +00:00
};
const CSSLoader = {
2024-01-22 02:11:38 +00:00
loader: "css-loader",
options: {
modules: "global",
importLoaders: 2,
sourceMap: true,
},
2024-01-22 01:55:09 +00:00
};
const PostCSSLoader = {
2024-01-22 02:11:38 +00:00
loader: "postcss-loader",
options: {
sourceMap: true,
},
2024-01-22 01:55:09 +00:00
};
2024-01-22 02:11:38 +00:00
const styleLoader = "style-loader";
2024-01-22 01:55:09 +00:00
2024-01-21 22:54:00 +00:00
module.exports = {
2024-01-22 02:11:38 +00:00
entry: "./src/index.tsx",
output: {
path: path.resolve(__dirname, "dist"),
filename: "bundle.[hash].js",
},
devServer: {
compress: true,
port: 8080,
hot: true,
static: "./dist",
historyApiFallback: true,
open: true,
},
module: {
rules: [
{
test: /\.(js|jsx)$/,
exclude: /node_modules/,
use: {
loader: "babel-loader",
},
},
{
test: /\.tsx?$/,
exclude: /node_modules/,
use: { loader: "ts-loader" },
},
{
test: /\.(sa|sc|c)ss$/,
exclude: /\.module\.(sa|sc|c)ss$/,
use: [styleLoader, CSSLoader, PostCSSLoader],
},
{
test: /\.module\.(sa|sc|c)ss$/,
use: [styleLoader, CSSModuleLoader, PostCSSLoader],
},
2024-01-21 22:54:00 +00:00
],
2024-01-22 02:11:38 +00:00
},
plugins: [
new HtmlWebpackPlugin({
template: __dirname + "/public/index.html",
filename: "index.html",
}),
],
experiments: {
asyncWebAssembly: true,
},
resolve: {
extensions: [".tsx", ".ts", ".js"],
},
2024-01-21 22:54:00 +00:00
};