This repository has been archived by the owner on Mar 24, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 423
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Internal: add prepack command to studio-base to create module (#1463)
- Loading branch information
1 parent
f148bce
commit 02cf28d
Showing
8 changed files
with
134 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{ | ||
"extends": "@foxglove/tsconfig/base", | ||
"include": ["./src/**/*", "./src/**/*.json", "./src/.storybook/**/*", "../package.json"], | ||
"compilerOptions": { | ||
"jsx": "react-jsx", | ||
"lib": ["dom", "dom.iterable", "es2020", "webworker"], | ||
"paths": { | ||
"@foxglove/studio-base/*": ["./*"] | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"extends": "@foxglove/tsconfig/base", | ||
"include": ["*.ts"], | ||
"compilerOptions": { | ||
"rootDir": ".", | ||
"module": "commonjs", | ||
"lib": ["es2020"] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
// This Source Code Form is subject to the terms of the Mozilla Public | ||
// License, v2.0. If a copy of the MPL was not distributed with this | ||
// file, You can obtain one at http://mozilla.org/MPL/2.0/ | ||
|
||
/* eslint-disable filenames/match-exported */ | ||
|
||
import { CleanWebpackPlugin } from "clean-webpack-plugin"; | ||
import path from "path"; | ||
import { Configuration } from "webpack"; | ||
|
||
import { WebpackArgv } from "@foxglove/studio-base/WebpackArgv"; | ||
import { makeConfig } from "@foxglove/studio-base/webpack"; | ||
|
||
const mainConfig = (env: unknown, argv: WebpackArgv): Configuration => { | ||
const isDev = argv.mode === "development"; | ||
const allowUnusedVariables = isDev; | ||
|
||
const appWebpackConfig = makeConfig(env, argv, { allowUnusedVariables }); | ||
|
||
const config: Configuration = { | ||
...appWebpackConfig, | ||
|
||
target: "web", | ||
context: path.resolve(__dirname, "src"), | ||
entry: "./index.ts", | ||
devtool: isDev ? "eval-cheap-module-source-map" : "inline-source-map", | ||
|
||
// There should only be one version of react (and react-dom) in a component tree | ||
// We expect the user to provide their version of react | ||
externals: { | ||
react: "react", | ||
"react-dom": "react-dom", | ||
}, | ||
|
||
optimization: { | ||
minimize: false, | ||
}, | ||
|
||
output: { | ||
publicPath: "", | ||
filename: "index.js", | ||
path: path.resolve(__dirname, "assets"), | ||
library: { | ||
type: "umd", | ||
}, | ||
}, | ||
|
||
plugins: [new CleanWebpackPlugin(), ...(appWebpackConfig.plugins ?? [])], | ||
}; | ||
|
||
return config; | ||
}; | ||
|
||
export default mainConfig; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters