forked from OHIF/Viewers
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ci: set NODE_ENV, fix out of memory issue, fix hot reload bundling
* ci: test docs-publish * Specify to use prod * Babel should transpile with env set by webpack * chore: production defaults to true; set in --env.production by cli * Remove lingering merge issue * Add minimification plugins * Need relative URLs to find root assets * Default public url to forward slash in define plugin * Don't wrap w/ react-hot-loader if we're building for production * No need to log extensions * Minimize using terser; and minimize css * Import redux from es; this bypasses commonjs as import and fixes our "production build" warning * Split commone webpack build for now to test hotfix * postfix slash * undefined safe env access * Try to fix node_env prod issue w/ redux * Set NODE_ENV production for all prod builds * Syntax error * nix tests * Increase max amount of available memory * Don't run bundle analyzer by default
- Loading branch information
Showing
15 changed files
with
191 additions
and
36 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,101 @@ | ||
const path = require('path'); | ||
const webpack = require('webpack'); | ||
const autoprefixer = require('autoprefixer'); | ||
|
||
module.exports = (env, argv, { SRC_DIR, DIST_DIR }) => { | ||
const mode = | ||
process.env.NODE_ENV === 'production' ? 'production' : 'development'; | ||
|
||
return { | ||
mode, | ||
entry: { | ||
bundle: `${SRC_DIR}/index.js`, | ||
}, | ||
context: SRC_DIR, | ||
module: { | ||
rules: [ | ||
/** | ||
* JSX | ||
*/ | ||
{ | ||
test: /\.jsx?$/, | ||
exclude: [/node_modules/, /packages\\extension/], | ||
loader: 'babel-loader', | ||
options: { | ||
// Find babel.config.js in monorepo root | ||
// https://babeljs.io/docs/en/options#rootmode | ||
rootMode: 'upward', | ||
envName: mode, | ||
presets: [ | ||
[ | ||
'@babel/preset-env', | ||
{ | ||
// Do not transform ES6 modules to another format. | ||
// Webpack will take care of that. | ||
modules: false, | ||
targets: { | ||
ie: '11', | ||
}, | ||
// https://babeljs.io/docs/en/babel-preset-env#usebuiltins | ||
useBuiltIns: 'usage', | ||
// https://babeljs.io/docs/en/babel-preset-env#corejs | ||
corejs: 3, | ||
}, | ||
], | ||
], | ||
}, | ||
}, | ||
/** | ||
* This allows us to include web workers in our bundle, and VTK.js | ||
* web workers in our bundle. While this increases bundle size, it | ||
* cuts down on the number of includes we need for `script tag` usage. | ||
*/ | ||
{ | ||
test: /\.worker\.js$/, | ||
include: /vtk\.js[\/\\]Sources/, | ||
use: [ | ||
{ | ||
loader: 'worker-loader', | ||
options: { inline: true, fallback: false }, | ||
}, | ||
], | ||
}, | ||
/** | ||
* This is exclusively used by `vtk.js` to bundle glsl files. | ||
*/ | ||
{ | ||
test: /\.glsl$/i, | ||
include: /vtk\.js[\/\\]Sources/, | ||
loader: 'shader-loader', | ||
}, | ||
], | ||
}, | ||
resolve: { | ||
// Which directories to search when resolving modules | ||
modules: [ | ||
// Modules specific to this package | ||
path.resolve(__dirname, '../node_modules'), | ||
// Hoisted Yarn Workspace Modules | ||
path.resolve(__dirname, '../../../node_modules'), | ||
SRC_DIR, | ||
], | ||
// Attempt to resolve these extensions in order. | ||
extensions: ['.js', '.jsx', '.json', '*'], | ||
// symlinked resources are resolved to their real path, not their symlinked location | ||
symlinks: true, | ||
}, | ||
plugins: [ | ||
new webpack.DefinePlugin({ | ||
'process.env.NODE_ENV': JSON.stringify(process.env.NODE_ENV), | ||
'process.env.DEBUG': JSON.stringify(process.env.DEBUG), | ||
'process.env.APP_CONFIG': JSON.stringify(process.env.APP_CONFIG || ''), | ||
'process.env.PUBLIC_URL': JSON.stringify(process.env.PUBLIC_URL || '/'), | ||
}), | ||
], | ||
// Fix: https://github.com/webpack-contrib/css-loader/issues/447#issuecomment-285598881 | ||
// For issue in cornerstone-wado-image-loader | ||
node: { | ||
fs: 'empty', | ||
}, | ||
}; | ||
}; |
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
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
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
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
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
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
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