forked from Azure/autorest
-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.js
45 lines (41 loc) · 1.41 KB
/
webpack.config.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
// @ts-check
const path = require("path");
const CopyPlugin = require("copy-webpack-plugin");
const baseWebpackConfig = require("../../../common/config/webpack.base.config");
/**
* @type {import("webpack").Configuration}
*/
module.exports = {
...baseWebpackConfig,
entry: {
app: "./src/app.ts",
"language-service": "./src/language-service/language-service.ts",
exports: "./src/exports.ts",
},
output: {
...baseWebpackConfig.output,
path: path.resolve(__dirname, "dist"),
libraryTarget: "commonjs2",
},
plugins: [
// We need to copy the yarn cli.js so @azure-tools/extensions can call the file as it is.(Not bundled in the webpack bundle.)
new CopyPlugin({
patterns: [{ from: "node_modules/@azure-tools/extension/dist/yarn/cli.js", to: "yarn/cli.js" }],
}),
// We need to copy the default configuration resources files.
new CopyPlugin({
patterns: [{ from: "node_modules/@autorest/configuration/resources", to: "resources" }],
}),
// We need to copy mappings.wasm so it can be loaded by SourceMapConsumer https://github.com/mozilla/source-map
new CopyPlugin({
patterns: [{ from: "node_modules/source-map/lib/mappings.wasm", to: "mappings.wasm" }],
}),
],
optimization: {
...baseWebpackConfig.optimization,
// Makes sure the different endpoints don't duplicate share common code.
splitChunks: {
chunks: "all",
},
},
};