77 lines
1.6 KiB
JavaScript
77 lines
1.6 KiB
JavaScript
//@ts-check
|
|
|
|
'use strict';
|
|
|
|
const WasmPackPlugin = require('@wasm-tool/wasm-pack-plugin');
|
|
const path = require('path');
|
|
const TerserPlugin = require('terser-webpack-plugin');
|
|
|
|
/**@type {import('webpack').Configuration}*/
|
|
module.exports = {
|
|
target: 'node',
|
|
experiments: {
|
|
asyncWebAssembly: true
|
|
},
|
|
plugins: [
|
|
new WasmPackPlugin({
|
|
crateDirectory: path.resolve(__dirname, "../crates/lsp"),
|
|
extraArgs: "--target bundler -- --features wasm",
|
|
}),
|
|
],
|
|
optimization: {
|
|
moduleIds: 'deterministic',
|
|
chunkIds: 'deterministic',
|
|
usedExports: true,
|
|
sideEffects: true,
|
|
minimize: true,
|
|
minimizer: [
|
|
new TerserPlugin({
|
|
parallel: true,
|
|
terserOptions: {
|
|
compress: {
|
|
passes: 2
|
|
},
|
|
format: { comments: false },
|
|
mangle: true
|
|
}
|
|
})
|
|
]
|
|
},
|
|
performance: {
|
|
hints: false
|
|
},
|
|
entry: './src/extension.ts',
|
|
output: {
|
|
filename: 'extension.js',
|
|
path: path.resolve(__dirname, 'dist'),
|
|
devtoolModuleFilenameTemplate: '../[resource-path]'
|
|
},
|
|
devtool: 'nosources-source-map',
|
|
externals: {
|
|
vscode: 'commonjs vscode'
|
|
},
|
|
resolve: {
|
|
mainFields: ['browser', 'module', 'main'],
|
|
extensions: ['.ts', '.js'],
|
|
alias: {
|
|
"kerolox-lsp": path.resolve(__dirname, "../crates/lsp/pkg/index.js")
|
|
},
|
|
fallback: {
|
|
stream: require.resolve('stream-browserify')
|
|
}
|
|
},
|
|
module: {
|
|
rules: [
|
|
{
|
|
test: /\.ts$/,
|
|
exclude: /node_modules/,
|
|
use: [
|
|
{
|
|
loader: 'ts-loader'
|
|
}
|
|
]
|
|
}
|
|
]
|
|
}
|
|
};
|