Skip to content

Commit

Permalink
Fixes OpenSSL issue by using legacy provider
Browse files Browse the repository at this point in the history
  • Loading branch information
amandasavluchinske committed Dec 18, 2023
2 parents 284e1d2 + 6298fd5 commit 2f4da93
Show file tree
Hide file tree
Showing 5 changed files with 89 additions and 56 deletions.
56 changes: 56 additions & 0 deletions .github/workflows/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
name: main

on:
push:
branches: [ master ]
pull_request:
branches: [ master ]

jobs:
# Oldest maintenance LTS, End-of-Life 2025-04-30
test-node-18:
runs-on: ubuntu-latest
container:
image: node:18.19
env:
NODE_OPTIONS: --openssl-legacy-provider
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Node.js
run: |
echo "Node version: $(node --version)"
echo "NPM version: $(npm --version)"
npm install
npm run ci
- name: Unset NODE_OPTIONS
run: |
unset NODE_OPTIONS
test:
runs-on: ubuntu-latest
strategy:
matrix:
node-version:
- "current"
- "20.10"
env:
NODE_OPTIONS: --openssl-legacy-provider
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
- name: Print Node.js version
run: |
echo "Node version: $(node --version)"
echo "NPM version: $(npm --version)"
- name: Install dependencies and run tests
run: |
npm install
npm run ci
- name: Unset NODE_OPTIONS
run: |
unset NODE_OPTIONS
28 changes: 0 additions & 28 deletions .github/workflows/test.yml

This file was deleted.

6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,11 @@ npm install --save-dev webpack-bundle-tracker

## Compatibility

This project is compatible with NodeJS versions 12 and up.
This project is compatible with NodeJS versions 16 and up.

:warning: Starting on version 17, NodeJS uses OpenSSL v3 which has compatibility issues with Webpack@4. This isn't an issue for Webpack@5, however
if you're using Node >= 17 and Webpack@4, to properly use this package you must ensure to set the `NODE_OPTIONS=--openssl-legacy-provider` environment
variable. You can read more about this on https://github.com/webpack/webpack/issues/14532.

## Migrating from version 1.x.y to 2.x.y
Starting on version 2.0.0, when creating a new instance of `BundleTracker`, the usage of the `path` parameter has been fixed and it's now being used to generate the output path for the stats file, together with the `filename` parameter. On version 2.0.0, if the `path` parameter is ommited from the constuctor call, it will attempt to place the stats file at the `output.path` directory (if also ommited, will use `'.'` as a fallback). Also, version 2.0.0 doesn't allow sub-directories to be included on the `filename`, only allowing to include them on the `path` param. To avoid those issues, when migrating, double-check if the file placement is as expected. The usage of these parameters is documented [here](#usage) and [here](#options).
Expand Down
30 changes: 16 additions & 14 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "webpack-bundle-tracker",
"version": "2.0.0",
"version": "2.0.1",
"description": "Spits out some stats about webpack compilation process to a file",
"keywords": [
"bundle",
Expand Down Expand Up @@ -38,36 +38,38 @@
"lodash.frompairs": "^4.0.1",
"lodash.get": "^4.4.2",
"lodash.topairs": "^4.3.0",
"strip-ansi": "^6.0.0"
"strip-ansi": "^6.0.1"
},
"devDependencies": {
"@types/lodash.assign": "^4.2.6",
"@types/lodash.defaults": "^4.2.6",
"@types/lodash.foreach": "^4.5.6",
"@types/babel__traverse": "7.0.6",
"@types/lodash": "4.14.173",
"@types/lodash.assign": "^4.2.7",
"@types/lodash.defaults": "^4.2.7",
"@types/lodash.foreach": "^4.5.7",
"@types/lodash.frompairs": "^4.0.7",
"@types/lodash.get": "^4.4.6",
"@types/lodash.get": "^4.4.7",
"@types/lodash.topairs": "^4.3.7",
"@types/node": "^13.13.52",
"@types/webpack": "^4.41.28",
"@types/webpack": "^4.41.33",
"@typescript-eslint/eslint-plugin": "^2.34.0",
"@typescript-eslint/parser": "^2.34.0",
"commitizen": "^4.2.4",
"commitizen": "^4.3.0",
"compression-webpack-plugin": "^6.1.1",
"css-loader": "^5.2.4",
"css-loader": "^5.2.7",
"cz-conventional-changelog": "3.3.0",
"eslint": "^6.8.0",
"file-loader": "^5.1.0",
"jest": "^25.5.4",
"jest-extended": "^0.11.5",
"mini-css-extract-plugin": "^1.6.0",
"mini-css-extract-plugin": "^1.6.2",
"prettier": "^1.19.1",
"standard-version": "^9.3.0",
"standard-version": "^9.5.0",
"style-loader": "^1.3.0",
"tslint": "^6.1.0",
"typescript": "^3.9.9",
"typescript": "^3.9.10",
"webpack": "^4.46.0",
"webpack-cli": "^4.7.0",
"webpack5": "npm:webpack@^5.75.0"
"webpack-cli": "^4.10.0",
"webpack5": "npm:webpack@^5.83.1"
},
"config": {
"commitizen": {
Expand Down
25 changes: 12 additions & 13 deletions tests/base.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ const rimraf = require('rimraf');
const webpack = require('webpack');

const { OUTPUT_DIR, testPlugin, getWebpack4WarningMessage } = require('./utils.js');
const skipIfCi = () => (process.env.CI ? it.skip : it);

const CompressionPlugin = require('compression-webpack-plugin');
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
Expand All @@ -24,7 +23,7 @@ describe('BundleTrackerPlugin bases tests', () => {
rimraf(path.join(OUTPUT_DIR, '*'), done);
});

skipIfCi()('It should generate stats for a single entrypoint', done => {
it('It should generate stats for a single entrypoint', done => {
const expectErrors = null;
const expectWarnings = getWebpack4WarningMessage();

Expand Down Expand Up @@ -66,7 +65,7 @@ describe('BundleTrackerPlugin bases tests', () => {
);
});

skipIfCi()('It should add log time when option is set', done => {
it('It should add log time when option is set', done => {
const expectErrors = null;
const expectWarnings = getWebpack4WarningMessage();

Expand Down Expand Up @@ -100,7 +99,7 @@ describe('BundleTrackerPlugin bases tests', () => {
);
});

skipIfCi()('It should overwrite publicPath when option is set', done => {
it('It should overwrite publicPath when option is set', done => {
const expectErrors = null;
const expectWarnings = getWebpack4WarningMessage();

Expand Down Expand Up @@ -143,7 +142,7 @@ describe('BundleTrackerPlugin bases tests', () => {
);
});

skipIfCi()('It should overwrite filename when option is set', done => {
it('It should overwrite filename when option is set', done => {
const expectErrors = null;
const expectWarnings = getWebpack4WarningMessage();

Expand Down Expand Up @@ -186,7 +185,7 @@ describe('BundleTrackerPlugin bases tests', () => {
);
});

skipIfCi()('It should create intermediate directory if path option is set with intermediate directory', done => {
it('It should create intermediate directory if path option is set with intermediate directory', done => {
const expectErrors = null;
const expectWarnings = getWebpack4WarningMessage();

Expand Down Expand Up @@ -229,7 +228,7 @@ describe('BundleTrackerPlugin bases tests', () => {
);
});

skipIfCi()('It should show error when compilation errors', done => {
it('It should show error when compilation errors', done => {
const expectErrors = expect.stringMatching(
/^ModuleNotFoundError: Module not found: Error: (Can't resolve|Cannot resolve module) 'toto' in '?.*?\/fixtures'?$/,
);
Expand Down Expand Up @@ -267,7 +266,7 @@ describe('BundleTrackerPlugin bases tests', () => {
);
});

skipIfCi()('It should set relative path when option is set', done => {
it('It should set relative path when option is set', done => {
const expectErrors = null;
const expectWarnings = getWebpack4WarningMessage();

Expand Down Expand Up @@ -309,7 +308,7 @@ describe('BundleTrackerPlugin bases tests', () => {
);
});

skipIfCi()('It should show dependant files when webpack splitChunk options is used', done => {
it('It should show dependant files when webpack splitChunk options is used', done => {
const expectErrors = null;
const expectWarnings = getWebpack4WarningMessage();

Expand Down Expand Up @@ -390,7 +389,7 @@ describe('BundleTrackerPlugin bases tests', () => {
);
});

skipIfCi()('It should show dependant files when webpack integrity options is used', done => {
it('It should show dependant files when webpack integrity options is used', done => {
const expectErrors = null;
const expectWarnings = getWebpack4WarningMessage();

Expand Down Expand Up @@ -486,7 +485,7 @@ describe('BundleTrackerPlugin bases tests', () => {
);
});

skipIfCi()('It should show compressed assets', done => {
it('It should show compressed assets', done => {
const expectErrors = null;
const expectWarnings = getWebpack4WarningMessage();

Expand Down Expand Up @@ -640,7 +639,7 @@ describe('BundleTrackerPlugin bases tests', () => {
);
});

skipIfCi()('correctly merges chunks after multiple runs', done => {
it('correctly merges chunks after multiple runs', done => {
fs.writeFileSync(
path.join(OUTPUT_DIR, 'app1.js'),
`require(${JSON.stringify(path.resolve(__dirname, 'fixtures', 'commons.js'))});`,
Expand Down Expand Up @@ -706,7 +705,7 @@ describe('BundleTrackerPlugin bases tests', () => {
);
});

skipIfCi()('sorts assets and chunks properties in alphabetical order', done => {
it('sorts assets and chunks properties in alphabetical order', done => {
const expectErrors = null;
const expectWarnings = getWebpack4WarningMessage();

Expand Down

0 comments on commit 2f4da93

Please sign in to comment.