diff --git a/web/jsconfig.json b/web/jsconfig.json new file mode 100644 index 0000000..6cf3f0d --- /dev/null +++ b/web/jsconfig.json @@ -0,0 +1,17 @@ +{ + "compilerOptions": { + // "baseUrl": "./src", + "target": "es6", + "checkJs": true, + "allowJs": true, + "moduleResolution": "nodenext", + "allowSyntheticDefaultImports": true, + "paths": { + "openmct": ["./node_modules/openmct/dist/openmct.d.ts"] + } + }, + "exclude": [ + "./dist/**/*", + "webpack.*.js" + ] +} diff --git a/web/package-lock.json b/web/package-lock.json index a1a3edf..c4250d6 100644 --- a/web/package-lock.json +++ b/web/package-lock.json @@ -23,7 +23,8 @@ "typescript": "^4.9.5", "webpack": "^5.75.0", "webpack-cli": "^5.0.1", - "webpack-dev-server": "^4.11.1" + "webpack-dev-server": "^4.11.1", + "webpack-merge": "^5.10.0" } }, "node_modules/@aashutoshrathi/word-wrap": { diff --git a/web/package.json b/web/package.json index 8901c2a..b00dfcb 100644 --- a/web/package.json +++ b/web/package.json @@ -5,8 +5,8 @@ "main": "index.js", "scripts": { "test": "echo \"Error: no test specified\" && exit 1", - "build": "webpack", - "serve": "webpack serve" + "build": "webpack --config webpack.prod.js", + "serve": "webpack serve --config webpack.dev.js" }, "author": "", "license": "ISC", @@ -25,6 +25,7 @@ "typescript": "^4.9.5", "webpack": "^5.75.0", "webpack-cli": "^5.0.1", - "webpack-dev-server": "^4.11.1" + "webpack-dev-server": "^4.11.1", + "webpack-merge": "^5.10.0" } } diff --git a/web/src/app.js b/web/src/app.js index 74984ab..9dab67d 100644 --- a/web/src/app.js +++ b/web/src/app.js @@ -7,6 +7,13 @@ openmct.install(openmct.plugins.UTCTimeSystem()); openmct.time.clock('local', {start: -5 * 60 * 1000, end: 0}); openmct.time.timeSystem('utc'); openmct.install(openmct.plugins.Espresso()); -openmct.install(PhoebusPlugin()); + +if (process.env.BASE_URL) { + console.log("got a thing") + console.log(process.env.BASE_URL) +} +function GotelemPlugin() { + +} openmct.start(); diff --git a/web/tsconfig.json b/web/tsconfig.json deleted file mode 100644 index ca6d425..0000000 --- a/web/tsconfig.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "compilerOptions": { - "baseUrl": "./src", - "target": "es6", - "checkJs": true, - "moduleResolution": "node", - "paths": { - "openmct": ["node_modules/openmct/dist/openmct.d.ts"] - } - } -} \ No newline at end of file diff --git a/web/webpack.config.js b/web/webpack.common.js similarity index 78% rename from web/webpack.config.js rename to web/webpack.common.js index 0089791..fb9a54f 100644 --- a/web/webpack.config.js +++ b/web/webpack.common.js @@ -5,7 +5,6 @@ const Dotenv = require('dotenv-webpack'); module.exports = { entry: './src/app.js', - mode: "development", module: { rules: [ { @@ -33,13 +32,6 @@ module.exports = { externals: { openmct: "openmct", }, - devServer: { - static: [{ - // eslint-disable-next-line no-undef - directory: path.join(__dirname, '/node_modules/openmct/dist'), - publicPath: '/node_modules/openmct/dist' - }] - }, output: { filename: 'main.js', path: path.resolve(__dirname, 'dist'), diff --git a/web/webpack.dev.js b/web/webpack.dev.js new file mode 100644 index 0000000..37cf099 --- /dev/null +++ b/web/webpack.dev.js @@ -0,0 +1,22 @@ +const { merge } = require('webpack-merge'); +const common = require('./webpack.common.js'); +const webpack = require('webpack'); + +module.exports = merge(common, { + mode: "development", + devtool: 'inline-source-map', + plugins: [ + new webpack.EnvironmentPlugin({ + NODE_ENV: "development", + BASE_URL: "http://localhost:8080" + }), + ], + devServer: { + static: "./dist", + headers: { + "Access-Control-Allow-Origin": "*", + 'Access-Control-Allow-Headers': '*', + 'Access-Control-Allow-Methods': '*', + }, + }, +}) diff --git a/web/webpack.prod.js b/web/webpack.prod.js new file mode 100644 index 0000000..9c5ed24 --- /dev/null +++ b/web/webpack.prod.js @@ -0,0 +1,13 @@ +const { merge } = require('webpack-merge'); +const common = require('./webpack.common.js'); + +module.exports = merge(common, { + mode: "production", + plugins: [ + new webpack.EnvironmentPlugin({ + NODE_ENV: "production", + BASE_URL: "", + }); + ], + devtool: 'source-map', +})