ohif-viewer/.webpack/rules/transpileJavaScript.js
Erik Ziegler 3c9f3cb273
feat: Update to WADO Image Loader 4.0.3 to add dynamically imported WebAssembly codec support 🚀 (#2538)
* feat: update to prerelease of WADO Image Loader, add copy plugin to pull dist/dynamic-import into OHIF

* fix: Set empty public path

* perf: Add webpackPrefetch tags to lazy loaded components

* Switch to using webpack alias to use dynamic import version of WADO Image Loader

* fix lockfile

* prevent polyfilling zlib

* bump to wado image loader 4.0.3 with fix for public path
2021-09-24 09:06:52 +02:00

40 lines
1.4 KiB
JavaScript

const excludeNodeModulesExcept = require('./../helpers/excludeNodeModulesExcept.js');
function transpileJavaScript(mode) {
const exclude =
mode === 'production'
? excludeNodeModulesExcept([
'vtk.js',
// 'dicomweb-client',
// https://github.com/react-dnd/react-dnd/blob/master/babel.config.js
'react-dnd',
// https://github.com/dcmjs-org/dcmjs/blob/master/.babelrc
// https://github.com/react-dnd/react-dnd/issues/1342
// 'dcmjs', // contains: loglevelnext
// https://github.com/shellscape/loglevelnext#browser-support
// 'loglevelnext',
// https://github.com/dcmjs-org/dicom-microscopy-viewer/issues/35
// 'dicom-microscopy-viewer',
// https://github.com/openlayers/openlayers#supported-browsers
// 'ol', --> Should be fine
])
: excludeNodeModulesExcept([]);
return {
test: /\.(mjs|js|jsx)?$/,
// These are packages that are not transpiled to our lowest supported
// JS version (currently ES5). Most of these leverage ES6+ features,
// that we need to transpile to a different syntax.
exclude,
loader: 'babel-loader',
options: {
// Find babel.config.js in monorepo root
// https://babeljs.io/docs/en/options#rootmode
rootMode: 'upward',
envName: mode,
},
};
}
module.exports = transpileJavaScript;