tooling(webpack): base paths of rootfolder (#6123)

This commit is contained in:
Even Stensberg 2023-01-17 17:05:34 +01:00 committed by GitHub
parent 4889284335
commit 9ae58f8441
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 23 additions and 22 deletions

View File

@ -31,9 +31,11 @@ try {
console.warn(err);
}
const projectRootDir = path.resolve(__dirname, "..");
/** @type {import('webpack').Configuration} */
const config = {
context: path.join(__dirname, ".."),
context: projectRootDir,
entry: {
openmct: "./openmct.js",
generatorWorker: "./example/generator/generatorWorker.js",
@ -46,7 +48,7 @@ const config = {
output: {
globalObject: "this",
filename: "[name].js",
path: path.resolve(__dirname, "..", "dist"),
path: path.resolve(projectRootDir, "dist"),
library: "openmct",
libraryTarget: "umd",
publicPath: "",
@ -55,8 +57,8 @@ const config = {
},
resolve: {
alias: {
"@": path.join(__dirname, "..", "src"),
legacyRegistry: path.join(__dirname, "..", "src/legacyRegistry"),
"@": path.join(projectRootDir, "src"),
legacyRegistry: path.join(projectRootDir, "src/legacyRegistry"),
saveAs: "file-saver/src/FileSaver.js",
csv: "comma-separated-values",
EventEmitter: "eventemitter3",
@ -64,24 +66,21 @@ const config = {
"plotly-basic": "plotly.js-basic-dist",
"plotly-gl2d": "plotly.js-gl2d-dist",
"d3-scale": path.join(
__dirname,
"..",
projectRootDir,
"node_modules/d3-scale/dist/d3-scale.min.js"
),
printj: path.join(
__dirname,
"..",
projectRootDir,
"node_modules/printj/dist/printj.min.js"
),
styles: path.join(__dirname, "..", "src/styles"),
MCT: path.join(__dirname, "..", "src/MCT"),
testUtils: path.join(__dirname, "..", "src/utils/testUtils.js"),
styles: path.join(projectRootDir, "src/styles"),
MCT: path.join(projectRootDir, "src/MCT"),
testUtils: path.join(projectRootDir, "src/utils/testUtils.js"),
objectUtils: path.join(
__dirname,
"..",
projectRootDir,
"src/api/objects/object-utils.js"
),
utils: path.join(__dirname, "..", "src/utils")
utils: path.join(projectRootDir, "src/utils")
}
},
plugins: [

View File

@ -5,11 +5,12 @@ This configuration should be used for development purposes. It contains full sou
devServer (which be invoked using by `npm start`), and a non-minified Vue.js distribution.
If OpenMCT is to be used for a production server, use webpack.prod.js instead.
*/
const { merge } = require("webpack-merge");
const common = require("./webpack.common");
const path = require("path");
const webpack = require("webpack");
const { merge } = require("webpack-merge");
const common = require("./webpack.common");
const projectRootDir = path.resolve(__dirname, "..");
module.exports = merge(common, {
mode: "development",
@ -26,7 +27,7 @@ module.exports = merge(common, {
},
resolve: {
alias: {
vue: path.join(__dirname, "..", "node_modules/vue/dist/vue.js")
vue: path.join(projectRootDir, "node_modules/vue/dist/vue.js")
}
},
plugins: [

View File

@ -4,17 +4,18 @@
This configuration should be used for production installs.
It is the default webpack configuration.
*/
const { merge } = require("webpack-merge");
const common = require("./webpack.common");
const path = require("path");
const webpack = require("webpack");
const { merge } = require("webpack-merge");
const common = require("./webpack.common");
const projectRootDir = path.resolve(__dirname, "..");
module.exports = merge(common, {
mode: "production",
resolve: {
alias: {
vue: path.join(__dirname, "..", "node_modules/vue/dist/vue.min.js")
vue: path.join(projectRootDir, "node_modules/vue/dist/vue.min.js")
}
},
plugins: [