Skip to content

Instantly share code, notes, and snippets.

@movahhedi
Created May 9, 2023 06:07
Show Gist options
  • Save movahhedi/fe1f4a1a32006fab227965e8bd7c697e to your computer and use it in GitHub Desktop.
Save movahhedi/fe1f4a1a32006fab227965e8bd7c697e to your computer and use it in GitHub Desktop.
AdmoPro's Old Webpack Configuration
import * as path from "path";
// import * as ForkTsCheckerWebpackPlugin from "fork-ts-checker-webpack-plugin";
import { fileURLToPath } from "url";
// Bring in the ability to create the `require()` method
import { createRequire } from "module";
// construct the require method
const require = createRequire(import.meta.url);
const ForkTsCheckerWebpackPlugin = require("fork-ts-checker-webpack-plugin");
const __dirname = path.dirname(fileURLToPath(import.meta.url));
export default {
context: __dirname,
entry: "./src/assets/scripts/app.tsx",
module: {
/*rules: [
{
test: /\.tsx?$/,
use: "babel-loader",
exclude: /node_modules/,
},
],*/
rules: [{
test: /\.ts(x?)$/,
exclude: /node_modules/,
use: [
{
loader: "babel-loader",
},
/*{
loader: "ts-loader",
}*/
]
}, {
test: /\.js$/,
exclude: /node_modules/,
use: [
{
loader: "babel-loader",
}
]
}]
},
resolve: {
extensions: [".tsx", ".ts", ".js", ".jsx"],
},
output: {
filename: "script.js",
path: path.resolve(__dirname, "build/assets/js"),
},
devtool: "source-map",
mode: "production",
watch: true,
plugins: [new ForkTsCheckerWebpackPlugin()]
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment