Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ref: Remove references to Webpack 4 #43

Merged
merged 10 commits into from
Jan 4, 2024
8 changes: 8 additions & 0 deletions .changeset/flat-coats-jump.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
"@codecov/webpack-plugin": patch
"@codecov/bundler-plugin-core": patch
"@codecov/rollup-plugin": patch
"@codecov/vite-plugin": patch
---

Remove references to Webpack 4, as we currently on support Node 18+.
8 changes: 4 additions & 4 deletions packages/webpack-plugin/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,7 @@
"test:unit:ci": "jest --coverage"
},
"dependencies": {
"@codecov/bundler-plugin-core": "workspace:^",
"webpack": "5.89.0"
nicholas-codecov marked this conversation as resolved.
Show resolved Hide resolved
"@codecov/bundler-plugin-core": "workspace:^"
nicholas-codecov marked this conversation as resolved.
Show resolved Hide resolved
},
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just to confirm, moving '@codecov/bundler-plugin-core' inside dependencies but moving 'webpack' out of it, into devDependencies could impact runtime if webpack is a runtime dependency. Please ensure that webpack is only needed in development and not in production.

"devDependencies": {
"@swc/core": "^1.3.99",
Expand All @@ -55,10 +54,11 @@
"msw": "^2.0.9",
"ts-node": "^10.9.1",
"typescript": "^5.3.2",
"unbuild": "^2.0.0"
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's good that you've moved 'webpack' into 'devDependencies', but please make sure that every development environment installs dev dependencies. This may not be the case in certain CI/CD pipelines.

"unbuild": "^2.0.0",
nicholas-codecov marked this conversation as resolved.
Show resolved Hide resolved
"webpack": "^5.89.0"
},
"peerDependencies": {
nicholas-codecov marked this conversation as resolved.
Show resolved Hide resolved
"webpack": "^5.0"
nicholas-codecov marked this conversation as resolved.
Show resolved Hide resolved
"webpack": "webpack@^5.0"
},
"volta": {
"extends": "../../package.json"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
normalizePath,
type BundleAnalysisUploadPlugin,
} from "@codecov/bundler-plugin-core";
import * as webpack4or5 from "webpack";
nicholas-codecov marked this conversation as resolved.
Show resolved Hide resolved
import * as webpack from "webpack";

import { findFilenameFormat } from "./findFileFormat";

const PLUGIN_NAME = "codecov-webpack-bundle-analysis-plugin";
Expand All @@ -20,7 +21,7 @@
compilation.hooks.processAssets.tap(
{
name: PLUGIN_NAME,
nicholas-codecov marked this conversation as resolved.
Show resolved Hide resolved
stage: webpack4or5.Compilation.PROCESS_ASSETS_STAGE_REPORT,
stage: webpack.Compilation.PROCESS_ASSETS_STAGE_REPORT,
},
() => {
// don't need to do anything if the bundle name is not present or empty
Expand All @@ -47,7 +48,7 @@

output.bundler = {
nicholas-codecov marked this conversation as resolved.
Show resolved Hide resolved
name: "webpack",
version: webpack4or5.version,
version: webpack.version,
};

const outputOptions = compilation.outputOptions;
Expand Down Expand Up @@ -131,7 +132,7 @@

nicholas-codecov marked this conversation as resolved.
Show resolved Hide resolved
// only output file if running dry run
if (userOptions?.dryRun) {
const { RawSource } = webpack4or5.sources;
const { RawSource } = webpack.sources;

Check warning on line 135 in packages/webpack-plugin/src/webpack-bundle-analysis/webpackBundleAnalysisPlugin.ts

View check run for this annotation

Codecov / codecov/patch

packages/webpack-plugin/src/webpack-bundle-analysis/webpackBundleAnalysisPlugin.ts#L135

Added line #L135 was not covered by tests
compilation.emitAsset(
"codecov-bundle-stats.json",
new RawSource(JSON.stringify(output)),
Expand Down
6 changes: 3 additions & 3 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.