ocrmnav
Version:
DevStack - The Complete Developer Toolkit - Virtual file system, workflow automation, and more than 65+ other development tools / features in one seamless extension. Cutting down dev times never before seen.
129 lines (122 loc) • 2.63 kB
JavaScript
//@ts-check
;
const path = require("path");
const nodeExternals = require("webpack-node-externals");
// "postinstall": "node ./node_modules/ocrmnav/dist/bin/cli.js --install",
// need to putt his in the packgage .json file
/** @typedef {import('webpack').Configuration} WebpackConfig **/
/** @type WebpackConfig */
const extensionConfig = {
target: "node",
mode: "none",
entry: "./src/extension.ts",
output: {
path: path.resolve(__dirname, "dist"),
filename: "extension.js",
libraryTarget: "commonjs2",
},
externals: {
vscode: "commonjs vscode",
},
resolve: {
extensions: [".ts", ".js"],
alias: {
"@helpers": path.resolve(__dirname, "src/helpers"),
},
},
module: {
rules: [
{
test: /\.ts$/,
exclude: /node_modules/,
use: ["ts-loader"],
},
{
test: /\.svg$/,
use: ["@svgr/webpack", "url-loader"],
},
],
},
devtool: "nosources-source-map",
infrastructureLogging: {
level: "log",
},
};
/** @type WebpackConfig */
const cliConfig = {
target: "node",
mode: "none",
entry: "./src/bin/cli.ts",
output: {
path: path.resolve(__dirname, "dist"),
filename: "cli.js",
libraryTarget: "commonjs2",
// Add this to prevent Webpack wrapper:
iife: false,
},
externals: {
// Explicitly externalize dependencies
vscode: "commonjs vscode",
},
resolve: {
extensions: [".ts", ".js"],
alias: {
"@helpers": path.resolve(__dirname, "src/helpers"),
},
},
module: {
rules: [
{
test: /\.ts$/,
exclude: /node_modules/,
use: [
{
loader: "ts-loader",
options: {
// Use this config for CLI
configFile: "tsconfig.cli.json",
},
},
],
},
],
},
};
const STRConfig = {
target: "node",
mode: "none",
entry: "./src/str/str.ts",
output: {
path: path.resolve(__dirname, "dist"),
filename: "str.js",
libraryTarget: "commonjs2",
iife: false,
},
externals: {
vscode: "commonjs vscode",
},
resolve: {
extensions: [".ts", ".js"],
alias: {
"@helpers": path.resolve(__dirname, "src/helpers"),
},
},
module: {
rules: [
{
test: /\.ts$/,
exclude: /node_modules/,
use: ["ts-loader"],
},
{
test: /\.svg$/,
use: ["@svgr/webpack", "url-loader"],
},
],
},
devtool: "nosources-source-map",
infrastructureLogging: {
level: "log",
},
};
module.exports = [extensionConfig, cliConfig];