Skip to content

Commit

Permalink
Fix source map warning from react-devtools
Browse files Browse the repository at this point in the history
  • Loading branch information
jhen0409 committed Jul 28, 2023
1 parent 727b627 commit a3eacd6
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
17 changes: 17 additions & 0 deletions scripts/patch-modules.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
const shell = require('shelljs')
const path = require('path')

console.log('Patch react-devtools-core')

const rdStandalone = path.join(
__dirname,
'../dist/node_modules/react-devtools-core/dist/standalone.js',
)

// Avoid source map not found war
shell.sed(
'-i',
/sourceMappingURL=importFile\.worker\.worker\.js\.map'\]\)\),\{name:"\[name\]\.worker\.js/g,
`sourceMappingURL_NotUsed=importFile.worker.worker.js.map'])),{name:"ReactDevToolsImportFile.worker.js`,
rdStandalone,
)
2 changes: 2 additions & 0 deletions scripts/postinstall.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ async function run() {
'-rf',
'node_modules/apollo-client-devtools/{assets,build,development,shells/dev,src}',
)
// eslint-disable-next-line
require('./patch-modules')
}

run()

0 comments on commit a3eacd6

Please sign in to comment.