Convert webpack config to ES6

This commit is contained in:
Joshua Lochner 2023-04-24 06:09:10 +02:00
parent 17349d18a2
commit 29b7f9a6fd
1 changed files with 15 additions and 4 deletions

View File

@ -1,8 +1,12 @@
const webpack = require('webpack');
const CopyWebpackPlugin = require('copy-webpack-plugin');
const TerserPlugin = require('terser-webpack-plugin');
import webpack from 'webpack';
import CopyWebpackPlugin from 'copy-webpack-plugin';
import TerserPlugin from 'terser-webpack-plugin';
import { fileURLToPath } from 'url';
import path from 'path';
module.exports = {
const __dirname = path.dirname(fileURLToPath(import.meta.url));
export default {
mode: 'development',
devtool: 'source-map',
entry: {
@ -14,6 +18,9 @@ module.exports = {
output: {
filename: '[name].js',
path: __dirname,
library: {
type: 'module',
},
},
plugins: [
// Do not include node modules when bundling for the browser
@ -44,4 +51,8 @@ module.exports = {
},
port: 8080
},
experiments: {
topLevelAwait: true,
outputModule: true,
},
};