const path = require("path");
//const HtmlWebpackPlugin = require("html-webpack-plugin");
module.exports = {
mode: "production", // development | production
entry: {
index: {
import: '/src/index.js',
dependOn: 'shared',
},
FooC01: {
import: '/src/MyAreaC/FooC01/app.tsx', // 其他進入點
dependOn: 'shared',
},
FooC02: {
import: '/src/MyAreaC/FooC02/app.tsx', // 其他進入點
dependOn: 'shared',
},
shared: 'lodash',
},
output: {
path: path.resolve(__dirname, "./dist"),
publicPath: "/",
filename: "[name].bundle.js",
//library: { // library 只支援單一模組的樣子?這樣不合用。
// name: 'reactWidgets',
// type: 'umd',
//},
},
optimization: {
runtimeChunk: 'single',
},
//THIS IS JUST TO RESOLVE SOME EXENSIONS
resolve: {
extensions: ['.tsx', '.ts', '.js']
},
module: {
rules: [
{
test: /\.?js$/,
exclude: /node_modules/,
use: {
loader: "babel-loader",
options: {
presets: ["@babel/preset-env", "@babel/preset-react"],
},
},
},
// NEW RULE TO HANDLE TS-LOADER
{
test: /\.tsx?$/,
use: 'ts-loader',
exclude: /node_modules/
},
{
test: /\.css$/,
use: [
"style-loader",
"css-loader", // for styles
],
},
],
},
//plugins: [
// new HtmlWebpackPlugin({
// template: "./src/index.html", // base html
// }),
//],
};