build: Fix running webpack on ESM

This commit is contained in:
Elian Doran
2024-07-23 00:12:08 +03:00
parent 6f6ce38538
commit 3dbf8fb1c1
4 changed files with 7 additions and 5 deletions

View File

@@ -1,7 +1,9 @@
import { fileURLToPath } from "url";
import path from "path";
import assetPath from "./src/services/asset_path.js";
module.exports = {
const rootDir = path.dirname(fileURLToPath(import.meta.url));
export default {
mode: 'production',
entry: {
setup: './src/public/app/setup.js',
@@ -10,7 +12,7 @@ module.exports = {
},
output: {
publicPath: `${assetPath}/app-dist/`,
path: path.resolve(__dirname, 'src/public/app-dist'),
path: path.resolve(rootDir, 'src/public/app-dist'),
filename: '[name].js',
},
devtool: 'source-map',