golang-wasm/example/basic/webpack.config.js

53 lines
1.2 KiB
JavaScript

const path = require('path');
module.exports = {
entry: './src/index.js',
devServer: {
contentBase: path.resolve(__dirname, 'dist'),
compress: true,
port: 3000,
},
2021-03-21 07:41:36 +07:00
mode: "development",
output: {
filename: 'main.js',
path: path.resolve(__dirname, 'dist'),
},
resolve: {
2021-03-21 07:41:36 +07:00
extensions: [".js", ".go"],
fallback: {
"fs": false,
"os": false,
"util": false,
"tls": false,
"net": false,
"path": false,
"zlib": false,
"http": false,
"https": false,
"stream": false,
"crypto": false,
}
},
module: {
rules: [
{
test: /\.go$/,
use: [
{
2021-03-21 07:41:36 +07:00
loader: path.resolve(__dirname, '../../src/index.js')
}
]
}
]
},
performance: {
assetFilter: (file) => {
2021-03-21 07:41:36 +07:00
return !/(\.wasm|.map)$/.test(file)
}
},
ignoreWarnings: [
{
module: /wasm_exec.js$/
}
]
};