codetour/webpack.config.js

66 строки
1.3 KiB
JavaScript

const path = require("path");
const webpack = require("webpack");
const config = {
entry: "./src/extension.ts",
devtool: "source-map",
externals: {
vscode: "commonjs vscode"
},
resolve: {
fallback: {
os: require.resolve("os-browserify/browser"),
path: require.resolve("path-browserify")
},
extensions: [".ts", ".js", ".json"]
},
node: {
__filename: false,
__dirname: false
},
module: {
rules: [
{
test: /\.ts$/,
exclude: /node_modules/,
use: [
{
loader: "ts-loader"
}
]
}
]
},
plugins: [
new webpack.SourceMapDevToolPlugin({
test: /\.ts$/,
noSources: false,
module: true,
columns: true
})
]
};
const nodeConfig = {
...config,
target: 'node',
output: {
path: path.resolve(__dirname, 'dist'),
filename: 'extension-node.js',
libraryTarget: "commonjs2",
devtoolModuleFilenameTemplate: "../[resource-path]",
}
};
const webConfig = {
...config,
target: 'webworker',
output: {
path: path.resolve(__dirname, 'dist'),
filename: 'extension-web.js',
libraryTarget: "commonjs2",
devtoolModuleFilenameTemplate: "../[resource-path]",
}
};
module.exports = [nodeConfig, webConfig];