This commit is contained in:
Madis Kõosaar 2022-09-13 14:15:03 +03:00
Родитель 37fdb09108
Коммит 2efc73ab8e
2 изменённых файлов: 56 добавлений и 0 удалений

Просмотреть файл

@ -40,6 +40,7 @@
"clean": "npm run clean:vsix && rimraf dist",
"build": "grunt build",
"build:dev": "npm run clean && webpack --progress",
"build:release": "npm run clean && webpack --config webpack.prod.config.js --progress",
"postinstall": "typings install"
},
"dependencies": {

55
webpack.prod.config.js Normal file
Просмотреть файл

@ -0,0 +1,55 @@
const path = require("path");
const fs = require("fs");
// const webpack = require("webpack");
const CopyWebpackPlugin = require("copy-webpack-plugin");
module.exports = {
mode: "production",
target: "web",
entry: {
app: "./scripts/app.ts"
},
output: {
filename: "scripts/[name].js",
publicPath: "./dist",
libraryTarget: "amd"
},
externals: [
/^VSS\/.*/, /^TFS\/.*/, /^q$/
],
resolve: {
extensions: [".ts", ".tsx", ".js"],
alias: {
"vss-web-extension-sdk": path.resolve(__dirname, "node_modules/vss-web-extension-sdk/lib/VSS.SDK")
},
modules: [path.resolve("."), "node_modules"]
},
module: {
rules: [
{
test: /\.tsx?$/,
use: "ts-loader"
},
{
test: /\.css$/,
use: ["style-loader", "css-loader"]
},
{
test: /\.(png|svg|jpg|gif|html)$/,
use: "file-loader"
}
]
},
plugins: [
new CopyWebpackPlugin({
patterns: [
{ from: "./node_modules/vss-web-extension-sdk/lib/VSS.SDK.min.js", to: "./scripts/VSS.SDK.min.js" },
{ from: "**/*.css", to: "./css", context: "styles" },
{ from: "*.html", to: "./", context: "." },
{ from: "**/*.png", to: "./img", context: "img" },
{ from: "./azure-devops-extension.json", to: "azure-devops-extension.json" },
{ from: "./readme.md", to: "readme.md" }
]
})
]
};