mirror of
https://github.com/reduxjs/redux-devtools.git
synced 2025-06-03 20:53:09 +03:00
Remove pageScriptWrap
This commit is contained in:
parent
08eeb5ad96
commit
20b575a0b1
|
@ -5,7 +5,7 @@ import pug from 'pug';
|
|||
const args = process.argv.slice(2);
|
||||
const prod = !args.includes('--dev');
|
||||
|
||||
const commonEsbuildOptions = {
|
||||
await esbuild.build({
|
||||
bundle: true,
|
||||
logLevel: 'info',
|
||||
outdir: 'dist',
|
||||
|
@ -15,10 +15,6 @@ const commonEsbuildOptions = {
|
|||
'process.env.NODE_ENV': prod ? '"production"' : '"development"',
|
||||
'process.env.BABEL_ENV': prod ? '"production"' : '"development"',
|
||||
},
|
||||
};
|
||||
|
||||
await esbuild.build({
|
||||
...commonEsbuildOptions,
|
||||
entryPoints: [
|
||||
{ out: 'background.bundle', in: 'src/background/index.ts' },
|
||||
{ out: 'options.bundle', in: 'src/options/index.tsx' },
|
||||
|
@ -27,23 +23,12 @@ await esbuild.build({
|
|||
{ out: 'devtools.bundle', in: 'src/devtools/index.ts' },
|
||||
{ out: 'content.bundle', in: 'src/contentScript/index.ts' },
|
||||
{ out: 'page.bundle', in: 'src/pageScript/index.ts' },
|
||||
...(prod ? [] : [{ out: 'pagewrap.bundle', in: 'src/pageScriptWrap.ts' }]),
|
||||
],
|
||||
loader: {
|
||||
'.woff2': 'file',
|
||||
},
|
||||
});
|
||||
|
||||
if (prod) {
|
||||
await esbuild.build({
|
||||
...commonEsbuildOptions,
|
||||
entryPoints: [{ out: 'pagewrap.bundle', in: 'src/pageScriptWrap.ts' }],
|
||||
loader: {
|
||||
'.js': 'text',
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
console.log();
|
||||
|
||||
console.log('Creating HTML files...');
|
||||
|
|
|
@ -1,19 +0,0 @@
|
|||
// @ts-ignore
|
||||
import script from '../dist/page.bundle.js';
|
||||
|
||||
let s = document.createElement('script');
|
||||
s.type = 'text/javascript';
|
||||
|
||||
if (process.env.NODE_ENV === 'production') {
|
||||
s.appendChild(document.createTextNode(script));
|
||||
(document.head || document.documentElement).appendChild(s);
|
||||
s.parentNode!.removeChild(s);
|
||||
} else {
|
||||
s.src = chrome.extension.getURL('page.bundle.js');
|
||||
s.onload = function () {
|
||||
(this as HTMLScriptElement).parentNode!.removeChild(
|
||||
this as HTMLScriptElement,
|
||||
);
|
||||
};
|
||||
(document.head || document.documentElement).appendChild(s);
|
||||
}
|
Loading…
Reference in New Issue
Block a user