Convert webpack config to ES6
This commit is contained in:
parent
17349d18a2
commit
29b7f9a6fd
|
@ -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,
|
||||
},
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue