Revert "replace to 1st place in plugins"

This reverts commit face0e67e9.
This commit is contained in:
Albert Khalimov
2025-12-07 08:28:05 +00:00
parent fb220b50c0
commit 4d1b41d779
3 changed files with 21 additions and 22 deletions
+14 -15
View File
@@ -23,21 +23,7 @@ module.exports = {
// plugin set up and used to ensure as consist set of tests
// as possible.
getDefaultPlugins: (buildType, buildFormat = 'iife', es5 = false) => {
const plugins = [];
// This is what the build should be
const replaceOptions = {
preventAssignment: true,
WORKBOX_CDN_ROOT_URL: getVersionsCDNUrl(),
};
if (buildType) {
replaceOptions['process.env.NODE_ENV'] = JSON.stringify(buildType);
}
// Replace allows us to input NODE_ENV and strip code accordingly
plugins.push(replace(replaceOptions));
plugins.push(nodeResolve());
const plugins = [nodeResolve()];
const babelConfig = {
babelHelpers: 'bundled',
@@ -95,6 +81,19 @@ module.exports = {
plugins.push(terserPlugin(terserOptions));
}
// This is what the build should be
const replaceOptions = {
preventAssignment: true,
WORKBOX_CDN_ROOT_URL: getVersionsCDNUrl(),
};
if (buildType) {
replaceOptions['process.env.NODE_ENV'] = JSON.stringify(buildType);
}
// Replace allows us to input NODE_ENV and strip code accordingly
plugins.push(replace(replaceOptions));
return plugins;
},
};
+6 -6
View File
@@ -39,12 +39,6 @@ async function handler(req, res) {
const bundle = await rollup({
input: `./test/${packageName}/sw/` + testFilter,
plugins: [
replace({
'preventAssignment': true,
'process.env.NODE_ENV': JSON.stringify(env),
'SW_NAMESPACES': JSON.stringify(SW_NAMESPACES),
'WORKBOX_CDN_ROOT_URL': '/__WORKBOX/buildFile',
}),
multiEntry(),
nodeResolve({
moduleDirectories: ['packages', 'node_modules'],
@@ -54,6 +48,12 @@ async function handler(req, res) {
commonjs({
exclude: '*.mjs',
}),
replace({
'preventAssignment': true,
'process.env.NODE_ENV': JSON.stringify(env),
'SW_NAMESPACES': JSON.stringify(SW_NAMESPACES),
'WORKBOX_CDN_ROOT_URL': '/__WORKBOX/buildFile',
}),
],
// Fail in the case of warning, so rebuilds work.
onwarn({loc, message}) {
+1 -1
View File
@@ -43,12 +43,12 @@ export async function bundle({
await writeFile(temporaryFile, unbundledCode);
const plugins = [
nodeResolve(),
replace({
// See https://github.com/GoogleChrome/workbox/issues/2769
'preventAssignment': true,
'process.env.NODE_ENV': JSON.stringify(mode),
}),
nodeResolve(),
babel({
babelHelpers: 'bundled',
// Disable the logic that checks for local Babel config files: