mirror of
https://github.com/nasa/openmct.git
synced 2025-05-07 11:08:34 +00:00
tooling(webpack): move webpack to its own folder (#6076)
This commit is contained in:
parent
905373f294
commit
cdb202d8ba
176
.webpack/webpack.common.js
Normal file
176
.webpack/webpack.common.js
Normal file
@ -0,0 +1,176 @@
|
|||||||
|
/* global __dirname module */
|
||||||
|
|
||||||
|
/*
|
||||||
|
This is the OpenMCT common webpack file. It is imported by the other three webpack configurations:
|
||||||
|
- webpack.prod.js - the production configuration for OpenMCT (default)
|
||||||
|
- webpack.dev.js - the development configuration for OpenMCT
|
||||||
|
- webpack.coverage.js - imports webpack.dev.js and adds code coverage
|
||||||
|
There are separate npm scripts to use these configurations, though simply running `npm install`
|
||||||
|
will use the default production configuration.
|
||||||
|
*/
|
||||||
|
const path = require("path");
|
||||||
|
const packageDefinition = require("../package.json");
|
||||||
|
const CopyWebpackPlugin = require("copy-webpack-plugin");
|
||||||
|
const webpack = require("webpack");
|
||||||
|
const MiniCssExtractPlugin = require("mini-css-extract-plugin");
|
||||||
|
|
||||||
|
const { VueLoaderPlugin } = require("vue-loader");
|
||||||
|
let gitRevision = "error-retrieving-revision";
|
||||||
|
let gitBranch = "error-retrieving-branch";
|
||||||
|
|
||||||
|
try {
|
||||||
|
gitRevision = require("child_process")
|
||||||
|
.execSync("git rev-parse HEAD")
|
||||||
|
.toString()
|
||||||
|
.trim();
|
||||||
|
gitBranch = require("child_process")
|
||||||
|
.execSync("git rev-parse --abbrev-ref HEAD")
|
||||||
|
.toString()
|
||||||
|
.trim();
|
||||||
|
} catch (err) {
|
||||||
|
console.warn(err);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** @type {import('webpack').Configuration} */
|
||||||
|
const config = {
|
||||||
|
context: path.join(__dirname, ".."),
|
||||||
|
entry: {
|
||||||
|
openmct: "./openmct.js",
|
||||||
|
generatorWorker: "./example/generator/generatorWorker.js",
|
||||||
|
couchDBChangesFeed:
|
||||||
|
"./src/plugins/persistence/couch/CouchChangesFeed.js",
|
||||||
|
inMemorySearchWorker: "./src/api/objects/InMemorySearchWorker.js",
|
||||||
|
espressoTheme: "./src/plugins/themes/espresso-theme.scss",
|
||||||
|
snowTheme: "./src/plugins/themes/snow-theme.scss"
|
||||||
|
},
|
||||||
|
output: {
|
||||||
|
globalObject: "this",
|
||||||
|
filename: "[name].js",
|
||||||
|
path: path.resolve(__dirname, "..", "dist"),
|
||||||
|
library: "openmct",
|
||||||
|
libraryTarget: "umd",
|
||||||
|
publicPath: "",
|
||||||
|
hashFunction: "xxhash64",
|
||||||
|
clean: true
|
||||||
|
},
|
||||||
|
resolve: {
|
||||||
|
alias: {
|
||||||
|
"@": path.join(__dirname, "..", "src"),
|
||||||
|
legacyRegistry: path.join(__dirname, "..", "src/legacyRegistry"),
|
||||||
|
saveAs: "file-saver/src/FileSaver.js",
|
||||||
|
csv: "comma-separated-values",
|
||||||
|
EventEmitter: "eventemitter3",
|
||||||
|
bourbon: "bourbon.scss",
|
||||||
|
"plotly-basic": "plotly.js-basic-dist",
|
||||||
|
"plotly-gl2d": "plotly.js-gl2d-dist",
|
||||||
|
"d3-scale": path.join(
|
||||||
|
__dirname,
|
||||||
|
"..",
|
||||||
|
"node_modules/d3-scale/dist/d3-scale.min.js"
|
||||||
|
),
|
||||||
|
printj: path.join(
|
||||||
|
__dirname,
|
||||||
|
"..",
|
||||||
|
"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"),
|
||||||
|
objectUtils: path.join(
|
||||||
|
__dirname,
|
||||||
|
"..",
|
||||||
|
"src/api/objects/object-utils.js"
|
||||||
|
),
|
||||||
|
utils: path.join(__dirname, "..", "src/utils")
|
||||||
|
}
|
||||||
|
},
|
||||||
|
plugins: [
|
||||||
|
new webpack.DefinePlugin({
|
||||||
|
__OPENMCT_VERSION__: `'${packageDefinition.version}'`,
|
||||||
|
__OPENMCT_BUILD_DATE__: `'${new Date()}'`,
|
||||||
|
__OPENMCT_REVISION__: `'${gitRevision}'`,
|
||||||
|
__OPENMCT_BUILD_BRANCH__: `'${gitBranch}'`
|
||||||
|
}),
|
||||||
|
new VueLoaderPlugin(),
|
||||||
|
new CopyWebpackPlugin({
|
||||||
|
patterns: [
|
||||||
|
{
|
||||||
|
from: "src/images/favicons",
|
||||||
|
to: "favicons"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
from: "./index.html",
|
||||||
|
transform: function (content) {
|
||||||
|
return content.toString().replace(/dist\//g, "");
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
from: "src/plugins/imagery/layers",
|
||||||
|
to: "imagery"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}),
|
||||||
|
new MiniCssExtractPlugin({
|
||||||
|
filename: "[name].css",
|
||||||
|
chunkFilename: "[name].css"
|
||||||
|
})
|
||||||
|
],
|
||||||
|
module: {
|
||||||
|
rules: [
|
||||||
|
{
|
||||||
|
test: /\.(sc|sa|c)ss$/,
|
||||||
|
use: [
|
||||||
|
MiniCssExtractPlugin.loader,
|
||||||
|
{
|
||||||
|
loader: "css-loader"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
loader: "resolve-url-loader"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
loader: "sass-loader",
|
||||||
|
options: { sourceMap: true }
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
test: /\.vue$/,
|
||||||
|
use: "vue-loader"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
test: /\.html$/,
|
||||||
|
type: "asset/source"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
test: /\.(jpg|jpeg|png|svg)$/,
|
||||||
|
type: "asset/resource",
|
||||||
|
generator: {
|
||||||
|
filename: "images/[name][ext]"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
test: /\.ico$/,
|
||||||
|
type: "asset/resource",
|
||||||
|
generator: {
|
||||||
|
filename: "icons/[name][ext]"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
test: /\.(woff|woff2?|eot|ttf)$/,
|
||||||
|
type: "asset/resource",
|
||||||
|
generator: {
|
||||||
|
filename: "fonts/[name][ext]"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
stats: "errors-warnings",
|
||||||
|
performance: {
|
||||||
|
// We should eventually consider chunking to decrease
|
||||||
|
// these values
|
||||||
|
maxEntrypointSize: 25000000,
|
||||||
|
maxAssetSize: 25000000
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
module.exports = config;
|
@ -6,9 +6,9 @@ OpenMCT Continuous Integration servers use this configuration to add code covera
|
|||||||
information to pull requests.
|
information to pull requests.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
const config = require('./webpack.dev');
|
const config = require("./webpack.dev");
|
||||||
// eslint-disable-next-line no-undef
|
// eslint-disable-next-line no-undef
|
||||||
const CI = process.env.CI === 'true';
|
const CI = process.env.CI === "true";
|
||||||
|
|
||||||
config.devtool = CI ? false : undefined;
|
config.devtool = CI ? false : undefined;
|
||||||
|
|
||||||
@ -18,13 +18,18 @@ config.module.rules.push({
|
|||||||
test: /\.js$/,
|
test: /\.js$/,
|
||||||
exclude: /(Spec\.js$)|(node_modules)/,
|
exclude: /(Spec\.js$)|(node_modules)/,
|
||||||
use: {
|
use: {
|
||||||
loader: 'babel-loader',
|
loader: "babel-loader",
|
||||||
options: {
|
options: {
|
||||||
retainLines: true,
|
retainLines: true,
|
||||||
// eslint-disable-next-line no-undef
|
// eslint-disable-next-line no-undef
|
||||||
plugins: [['babel-plugin-istanbul', {
|
plugins: [
|
||||||
extension: ['.js', '.vue']
|
[
|
||||||
}]]
|
"babel-plugin-istanbul",
|
||||||
|
{
|
||||||
|
extension: [".js", ".vue"]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
@ -5,28 +5,28 @@ 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.
|
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.
|
If OpenMCT is to be used for a production server, use webpack.prod.js instead.
|
||||||
*/
|
*/
|
||||||
const { merge } = require('webpack-merge');
|
const { merge } = require("webpack-merge");
|
||||||
const common = require('./webpack.common');
|
const common = require("./webpack.common");
|
||||||
|
|
||||||
const path = require('path');
|
const path = require("path");
|
||||||
const webpack = require('webpack');
|
const webpack = require("webpack");
|
||||||
|
|
||||||
module.exports = merge(common, {
|
module.exports = merge(common, {
|
||||||
mode: 'development',
|
mode: "development",
|
||||||
watchOptions: {
|
watchOptions: {
|
||||||
// Since we use require.context, webpack is watching the entire directory.
|
// Since we use require.context, webpack is watching the entire directory.
|
||||||
// We need to exclude any files we don't want webpack to watch.
|
// We need to exclude any files we don't want webpack to watch.
|
||||||
// See: https://webpack.js.org/configuration/watch/#watchoptions-exclude
|
// See: https://webpack.js.org/configuration/watch/#watchoptions-exclude
|
||||||
ignored: [
|
ignored: [
|
||||||
'**/{node_modules,dist,docs,e2e}', // All files in node_modules, dist, docs, e2e,
|
"**/{node_modules,dist,docs,e2e}", // All files in node_modules, dist, docs, e2e,
|
||||||
'**/{*.yml,Procfile,webpack*.js,babel*.js,package*.json,tsconfig.json}', // Config files
|
"**/{*.yml,Procfile,webpack*.js,babel*.js,package*.json,tsconfig.json}", // Config files
|
||||||
'**/*.{sh,md,png,ttf,woff,svg}', // Non source files
|
"**/*.{sh,md,png,ttf,woff,svg}", // Non source files
|
||||||
'**/.*' // dotfiles and dotfolders
|
"**/.*" // dotfiles and dotfolders
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
resolve: {
|
resolve: {
|
||||||
alias: {
|
alias: {
|
||||||
"vue": path.join(__dirname, "node_modules/vue/dist/vue.js")
|
vue: path.join(__dirname, "..", "node_modules/vue/dist/vue.js")
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
plugins: [
|
plugins: [
|
||||||
@ -34,20 +34,20 @@ module.exports = merge(common, {
|
|||||||
__OPENMCT_ROOT_RELATIVE__: '"dist/"'
|
__OPENMCT_ROOT_RELATIVE__: '"dist/"'
|
||||||
})
|
})
|
||||||
],
|
],
|
||||||
devtool: 'eval-source-map',
|
devtool: "eval-source-map",
|
||||||
devServer: {
|
devServer: {
|
||||||
devMiddleware: {
|
devMiddleware: {
|
||||||
writeToDisk: (filePathString) => {
|
writeToDisk: (filePathString) => {
|
||||||
const filePath = path.parse(filePathString);
|
const filePath = path.parse(filePathString);
|
||||||
const shouldWrite = !(filePath.base.includes('hot-update'));
|
const shouldWrite = !filePath.base.includes("hot-update");
|
||||||
|
|
||||||
return shouldWrite;
|
return shouldWrite;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
watchFiles: ['**/*.css'],
|
watchFiles: ["**/*.css"],
|
||||||
static: {
|
static: {
|
||||||
directory: path.join(__dirname, '/dist'),
|
directory: path.join(__dirname, "..", "/dist"),
|
||||||
publicPath: '/dist',
|
publicPath: "/dist",
|
||||||
watch: false
|
watch: false
|
||||||
},
|
},
|
||||||
client: {
|
client: {
|
@ -4,17 +4,17 @@
|
|||||||
This configuration should be used for production installs.
|
This configuration should be used for production installs.
|
||||||
It is the default webpack configuration.
|
It is the default webpack configuration.
|
||||||
*/
|
*/
|
||||||
const { merge } = require('webpack-merge');
|
const { merge } = require("webpack-merge");
|
||||||
const common = require('./webpack.common');
|
const common = require("./webpack.common");
|
||||||
|
|
||||||
const path = require('path');
|
const path = require("path");
|
||||||
const webpack = require('webpack');
|
const webpack = require("webpack");
|
||||||
|
|
||||||
module.exports = merge(common, {
|
module.exports = merge(common, {
|
||||||
mode: 'production',
|
mode: "production",
|
||||||
resolve: {
|
resolve: {
|
||||||
alias: {
|
alias: {
|
||||||
"vue": path.join(__dirname, "node_modules/vue/dist/vue.min.js")
|
vue: path.join(__dirname, "..", "node_modules/vue/dist/vue.min.js")
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
plugins: [
|
plugins: [
|
||||||
@ -22,5 +22,5 @@ module.exports = merge(common, {
|
|||||||
__OPENMCT_ROOT_RELATIVE__: '""'
|
__OPENMCT_ROOT_RELATIVE__: '""'
|
||||||
})
|
})
|
||||||
],
|
],
|
||||||
devtool: 'source-map'
|
devtool: "source-map"
|
||||||
});
|
});
|
@ -28,12 +28,12 @@ module.exports = (config) => {
|
|||||||
let singleRun;
|
let singleRun;
|
||||||
|
|
||||||
if (process.env.KARMA_DEBUG) {
|
if (process.env.KARMA_DEBUG) {
|
||||||
webpackConfig = require('./webpack.dev.js');
|
webpackConfig = require("./.webpack/webpack.dev.js");
|
||||||
browsers = ['ChromeDebugging'];
|
browsers = ["ChromeDebugging"];
|
||||||
singleRun = false;
|
singleRun = false;
|
||||||
} else {
|
} else {
|
||||||
webpackConfig = require('./webpack.coverage.js');
|
webpackConfig = require("./.webpack/webpack.coverage.js");
|
||||||
browsers = ['ChromeHeadless'];
|
browsers = ["ChromeHeadless"];
|
||||||
singleRun = true;
|
singleRun = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -42,28 +42,28 @@ module.exports = (config) => {
|
|||||||
delete webpackConfig.entry;
|
delete webpackConfig.entry;
|
||||||
|
|
||||||
config.set({
|
config.set({
|
||||||
basePath: '',
|
basePath: "",
|
||||||
frameworks: ['jasmine', 'webpack'],
|
frameworks: ["jasmine", "webpack"],
|
||||||
files: [
|
files: [
|
||||||
'indexTest.js',
|
"indexTest.js",
|
||||||
// included means: should the files be included in the browser using <script> tag?
|
// included means: should the files be included in the browser using <script> tag?
|
||||||
// We don't want them as a <script> because the shared worker source
|
// We don't want them as a <script> because the shared worker source
|
||||||
// needs loaded remotely by the shared worker process.
|
// needs loaded remotely by the shared worker process.
|
||||||
{
|
{
|
||||||
pattern: 'dist/couchDBChangesFeed.js*',
|
pattern: "dist/couchDBChangesFeed.js*",
|
||||||
included: false
|
included: false
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
pattern: 'dist/inMemorySearchWorker.js*',
|
pattern: "dist/inMemorySearchWorker.js*",
|
||||||
included: false
|
included: false
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
pattern: 'dist/generatorWorker.js*',
|
pattern: "dist/generatorWorker.js*",
|
||||||
included: false
|
included: false
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
port: 9876,
|
port: 9876,
|
||||||
reporters: ['spec', 'junit', 'coverage-istanbul'],
|
reporters: ["spec", "junit", "coverage-istanbul"],
|
||||||
browsers,
|
browsers,
|
||||||
client: {
|
client: {
|
||||||
jasmine: {
|
jasmine: {
|
||||||
@ -73,8 +73,8 @@ module.exports = (config) => {
|
|||||||
},
|
},
|
||||||
customLaunchers: {
|
customLaunchers: {
|
||||||
ChromeDebugging: {
|
ChromeDebugging: {
|
||||||
base: 'Chrome',
|
base: "Chrome",
|
||||||
flags: ['--remote-debugging-port=9222'],
|
flags: ["--remote-debugging-port=9222"],
|
||||||
debug: true
|
debug: true
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -90,7 +90,7 @@ module.exports = (config) => {
|
|||||||
fixWebpackSourcePaths: true,
|
fixWebpackSourcePaths: true,
|
||||||
skipFilesWithNoCoverage: true,
|
skipFilesWithNoCoverage: true,
|
||||||
dir: "coverage/unit", //Sets coverage file to be consumed by codecov.io
|
dir: "coverage/unit", //Sets coverage file to be consumed by codecov.io
|
||||||
reports: ['lcovonly']
|
reports: ["lcovonly"]
|
||||||
},
|
},
|
||||||
specReporter: {
|
specReporter: {
|
||||||
maxLogLines: 5,
|
maxLogLines: 5,
|
||||||
@ -102,11 +102,11 @@ module.exports = (config) => {
|
|||||||
failFast: false
|
failFast: false
|
||||||
},
|
},
|
||||||
preprocessors: {
|
preprocessors: {
|
||||||
'indexTest.js': ['webpack', 'sourcemap']
|
"indexTest.js": ["webpack", "sourcemap"]
|
||||||
},
|
},
|
||||||
webpack: webpackConfig,
|
webpack: webpackConfig,
|
||||||
webpackMiddleware: {
|
webpackMiddleware: {
|
||||||
stats: 'errors-warnings'
|
stats: "errors-warnings"
|
||||||
},
|
},
|
||||||
concurrency: 1,
|
concurrency: 1,
|
||||||
singleRun,
|
singleRun,
|
||||||
|
12
package.json
12
package.json
@ -71,14 +71,14 @@
|
|||||||
"scripts": {
|
"scripts": {
|
||||||
"clean": "rm -rf ./dist ./node_modules ./package-lock.json",
|
"clean": "rm -rf ./dist ./node_modules ./package-lock.json",
|
||||||
"clean-test-lint": "npm run clean; npm install; npm run test; npm run lint",
|
"clean-test-lint": "npm run clean; npm install; npm run test; npm run lint",
|
||||||
"start": "npx webpack serve --config ./webpack.dev.js",
|
"start": "npx webpack serve --config ./.webpack/webpack.dev.js",
|
||||||
"start:coverage": "npx webpack serve --config ./webpack.coverage.js",
|
"start:coverage": "npx webpack serve --config ./.webpack/webpack.coverage.js",
|
||||||
"lint": "eslint example src e2e --ext .js,.vue openmct.js --max-warnings=0",
|
"lint": "eslint example src e2e --ext .js,.vue openmct.js --max-warnings=0",
|
||||||
"lint:fix": "eslint example src e2e --ext .js,.vue openmct.js --fix",
|
"lint:fix": "eslint example src e2e --ext .js,.vue openmct.js --fix",
|
||||||
"build:prod": "webpack --config webpack.prod.js",
|
"build:prod": "webpack --config ./.webpack/webpack.prod.js",
|
||||||
"build:dev": "webpack --config webpack.dev.js",
|
"build:dev": "webpack --config ./.webpack/webpack.dev.js",
|
||||||
"build:coverage": "webpack --config webpack.coverage.js",
|
"build:coverage": "webpack --config ./.webpack/webpack.coverage.js",
|
||||||
"build:watch": "webpack --config webpack.dev.js --watch",
|
"build:watch": "webpack --config ./.webpack/webpack.dev.js --watch",
|
||||||
"info": "npx envinfo --system --browsers --npmPackages --binaries --languages --markdown",
|
"info": "npx envinfo --system --browsers --npmPackages --binaries --languages --markdown",
|
||||||
"test": "karma start",
|
"test": "karma start",
|
||||||
"test:debug": "KARMA_DEBUG=true karma start",
|
"test:debug": "KARMA_DEBUG=true karma start",
|
||||||
|
@ -1,160 +0,0 @@
|
|||||||
/* global __dirname module */
|
|
||||||
|
|
||||||
/*
|
|
||||||
This is the OpenMCT common webpack file. It is imported by the other three webpack configurations:
|
|
||||||
- webpack.prod.js - the production configuration for OpenMCT (default)
|
|
||||||
- webpack.dev.js - the development configuration for OpenMCT
|
|
||||||
- webpack.coverage.js - imports webpack.dev.js and adds code coverage
|
|
||||||
There are separate npm scripts to use these configurations, though simply running `npm install`
|
|
||||||
will use the default production configuration.
|
|
||||||
*/
|
|
||||||
const path = require('path');
|
|
||||||
const packageDefinition = require('./package.json');
|
|
||||||
const CopyWebpackPlugin = require('copy-webpack-plugin');
|
|
||||||
const webpack = require('webpack');
|
|
||||||
const MiniCssExtractPlugin = require("mini-css-extract-plugin");
|
|
||||||
|
|
||||||
const {VueLoaderPlugin} = require('vue-loader');
|
|
||||||
let gitRevision = 'error-retrieving-revision';
|
|
||||||
let gitBranch = 'error-retrieving-branch';
|
|
||||||
|
|
||||||
try {
|
|
||||||
gitRevision = require('child_process')
|
|
||||||
.execSync('git rev-parse HEAD')
|
|
||||||
.toString().trim();
|
|
||||||
gitBranch = require('child_process')
|
|
||||||
.execSync('git rev-parse --abbrev-ref HEAD')
|
|
||||||
.toString().trim();
|
|
||||||
} catch (err) {
|
|
||||||
console.warn(err);
|
|
||||||
}
|
|
||||||
|
|
||||||
/** @type {import('webpack').Configuration} */
|
|
||||||
const config = {
|
|
||||||
entry: {
|
|
||||||
openmct: './openmct.js',
|
|
||||||
generatorWorker: './example/generator/generatorWorker.js',
|
|
||||||
couchDBChangesFeed: './src/plugins/persistence/couch/CouchChangesFeed.js',
|
|
||||||
inMemorySearchWorker: './src/api/objects/InMemorySearchWorker.js',
|
|
||||||
espressoTheme: './src/plugins/themes/espresso-theme.scss',
|
|
||||||
snowTheme: './src/plugins/themes/snow-theme.scss',
|
|
||||||
},
|
|
||||||
output: {
|
|
||||||
globalObject: 'this',
|
|
||||||
filename: '[name].js',
|
|
||||||
path: path.resolve(__dirname, 'dist'),
|
|
||||||
library: 'openmct',
|
|
||||||
libraryTarget: 'umd',
|
|
||||||
publicPath: '',
|
|
||||||
hashFunction: 'xxhash64',
|
|
||||||
clean: true
|
|
||||||
},
|
|
||||||
resolve: {
|
|
||||||
alias: {
|
|
||||||
"@": path.join(__dirname, "src"),
|
|
||||||
"legacyRegistry": path.join(__dirname, "src/legacyRegistry"),
|
|
||||||
"saveAs": "file-saver/src/FileSaver.js",
|
|
||||||
"csv": "comma-separated-values",
|
|
||||||
"EventEmitter": "eventemitter3",
|
|
||||||
"bourbon": "bourbon.scss",
|
|
||||||
"plotly-basic": "plotly.js-basic-dist",
|
|
||||||
"plotly-gl2d": "plotly.js-gl2d-dist",
|
|
||||||
"d3-scale": path.join(__dirname, "node_modules/d3-scale/dist/d3-scale.min.js"),
|
|
||||||
"printj": path.join(__dirname, "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"),
|
|
||||||
"objectUtils": path.join(__dirname, "src/api/objects/object-utils.js"),
|
|
||||||
"utils": path.join(__dirname, "src/utils")
|
|
||||||
}
|
|
||||||
},
|
|
||||||
plugins: [
|
|
||||||
new webpack.DefinePlugin({
|
|
||||||
__OPENMCT_VERSION__: `'${packageDefinition.version}'`,
|
|
||||||
__OPENMCT_BUILD_DATE__: `'${new Date()}'`,
|
|
||||||
__OPENMCT_REVISION__: `'${gitRevision}'`,
|
|
||||||
__OPENMCT_BUILD_BRANCH__: `'${gitBranch}'`
|
|
||||||
}),
|
|
||||||
new VueLoaderPlugin(),
|
|
||||||
new CopyWebpackPlugin({
|
|
||||||
patterns: [
|
|
||||||
{
|
|
||||||
from: 'src/images/favicons',
|
|
||||||
to: 'favicons'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
from: './index.html',
|
|
||||||
transform: function (content) {
|
|
||||||
return content.toString().replace(/dist\//g, '');
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
from: 'src/plugins/imagery/layers',
|
|
||||||
to: 'imagery'
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}),
|
|
||||||
new MiniCssExtractPlugin({
|
|
||||||
filename: '[name].css',
|
|
||||||
chunkFilename: '[name].css'
|
|
||||||
})
|
|
||||||
],
|
|
||||||
module: {
|
|
||||||
rules: [
|
|
||||||
{
|
|
||||||
test: /\.(sc|sa|c)ss$/,
|
|
||||||
use: [
|
|
||||||
MiniCssExtractPlugin.loader,
|
|
||||||
{
|
|
||||||
loader: 'css-loader'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
loader: 'resolve-url-loader'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
loader: 'sass-loader',
|
|
||||||
options: {sourceMap: true }
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
test: /\.vue$/,
|
|
||||||
use: 'vue-loader'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
test: /\.html$/,
|
|
||||||
type: 'asset/source'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
test: /\.(jpg|jpeg|png|svg)$/,
|
|
||||||
type: 'asset/resource',
|
|
||||||
generator: {
|
|
||||||
filename: 'images/[name][ext]'
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
test: /\.ico$/,
|
|
||||||
type: 'asset/resource',
|
|
||||||
generator: {
|
|
||||||
filename: 'icons/[name][ext]'
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
test: /\.(woff|woff2?|eot|ttf)$/,
|
|
||||||
type: 'asset/resource',
|
|
||||||
generator: {
|
|
||||||
filename: 'fonts/[name][ext]'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
stats: 'errors-warnings',
|
|
||||||
performance: {
|
|
||||||
// We should eventually consider chunking to decrease
|
|
||||||
// these values
|
|
||||||
maxEntrypointSize: 25000000,
|
|
||||||
maxAssetSize: 25000000
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
module.exports = config;
|
|
Loading…
x
Reference in New Issue
Block a user