Skip to content

Commit

Permalink
fiddle with terser
Browse files Browse the repository at this point in the history
  • Loading branch information
Jakeii committed Jan 6, 2025
1 parent 4be9256 commit 0694959
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 12 deletions.
2 changes: 1 addition & 1 deletion src/init/consented/prepare-prebid.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ const prebidVersion = () => {
const loadPrebid = async (framework: ConsentFramework): Promise<void> => {
if (shouldLoadPrebid()) {
await import(
/* webpackChunkName: "Prebid.js" */
/* webpackChunkName: "[request]" */
`@guardian/prebid.js/build/dist/${prebidVersion()}/prebid`
);
prebid.initialise(window, framework);
Expand Down
18 changes: 7 additions & 11 deletions webpack.config.mjs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { join } from 'path';
import CircularDependencyPlugin from 'circular-dependency-plugin';
import TerserPlugin from 'terser-webpack-plugin';

/**
* @type {import('webpack').Configuration}
Expand Down Expand Up @@ -31,21 +32,11 @@ const config = {
rules: [
{
test: /\.[jt]sx?|mjs$/,
exclude: {
and: [/node_modules/],
not: [
// Include all @guardian modules, except automat-modules and prebid.js
/@guardian\/(?!(automat-modules|prebid\.js))/,
// Include the dynamic-import-polyfill
/dynamic-import-polyfill/,
],
},
use: [
{
loader: 'swc-loader',
options: {
$schema: 'http://json.schemastore.org/swcrc',
minify: true,
jsc: {
parser: {
syntax: 'typescript',
Expand Down Expand Up @@ -78,7 +69,12 @@ const config = {
}),
],
optimization: {
minimize: false, // we use swc-loader to minify
minimize: true, // we use swc-loader to minify
minimizer: [
new TerserPlugin({
minify: TerserPlugin.swcMinify,
}),
],
},
};

Expand Down

0 comments on commit 0694959

Please sign in to comment.