Skip to content

Commit 8aabc55

Browse files
committed
Merge branch 'imodeljs' into cra5
2 parents 93836d7 + 3ceb8ec commit 8aabc55

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

packages/react-scripts/config/webpack.config.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,12 @@ module.exports = function (webpackEnv) {
144144

145145
const shouldUseReactRefresh = env.raw.FAST_REFRESH;
146146

147+
if (env.raw.IMJS_URL_PREFIX === undefined) {
148+
env.stringified[
149+
'process.env'
150+
].IMJS_URL_PREFIX = `(globalThis.IMJS_URL_PREFIX ? globalThis.IMJS_URL_PREFIX : "")`;
151+
}
152+
147153
// common function to get style loaders
148154
const getStyleLoaders = (cssOptions, preProcessor) => {
149155
const loaders = [
@@ -450,6 +456,9 @@ module.exports = function (webpackEnv) {
450456
module: {
451457
strictExportPresence: true,
452458
rules: [
459+
// Disable require.ensure as it's not a standard language feature.
460+
// Add support for magic comments in commonjs modules (i.e. webpackIgnore for dynamic imports)
461+
{ parser: { requireEnsure: false, commonjsMagicComments: true } },
453462
// Handle node_modules packages that contain sourcemaps
454463
shouldUseSourceMap && {
455464
enforce: 'pre',

0 commit comments

Comments
 (0)