Skip to content

experimenting with webpack #17872

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -65,3 +65,7 @@ test-results/
!.yarn/releases
!.yarn/sdks
!.yarn/versions


# Temporary webpack ignore distro folder
distro/*
3 changes: 2 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@
"editor.defaultFormatter": "rvest.vs-code-prettier-eslint",
"editor.tabSize": 2,
"files.trimTrailingWhitespace": true,
"javascript.preferences.importModuleSpecifier": "relative"
"javascript.preferences.importModuleSpecifier": "relative",
"typescript.preferences.importModuleSpecifier": "relative"
}
21 changes: 21 additions & 0 deletions development/webpack/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
### Webpack strategy

Currently I am just trying to incorporate as much of our current build process into the webpack.config.ts at the root of the application, but ultimately I think we should maintain a webpack.config.js for each of our environment targets (prod, test, dev, etc).

So we might have the following files:

1. webpack.config.common.ts - Configuration shared across all builds.
2. webpack.config.prod.ts - Configuration for our production build
3. webpack.config.dev.ts - Etc, same for test, staging, rc, etc.

we will also have files for chrome, firefox,etc

1. webpack.config.chrome.ts
2. webpack.config.firefox.ts

and finally

1. webpack.config.main.ts
2. webpack.config.flask.ts

Finally we'd use https://www.npmjs.com/package/webpack-merge to merge together these configurations based on environment variables and command line options.
26 changes: 26 additions & 0 deletions development/webpack/utils/constants.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/**
* The build target. This descrbes the overall purpose of the build.
*
* These constants also act as the high-level tasks for the build system (i.e.
* the usual tasks invoked directly via the CLI rather than internally).
*/
export enum BuildTarget {
dev = 'dev',
dist = 'dist',
prod = 'prod',
test = 'test',
testDev = 'testDev',
}

/**
* The build environment. This describes the environment this build was produced in.
*/
export enum BuildEnvironment {
development = 'development',
production = 'production',
other = 'other',
pullRequest = 'pull-request',
releaseCandidate = 'release-candidate',
staging = 'staging',
testing = 'testing',
}
Loading