Skip to content

Commit

Permalink
refactor: dropped webpack@4 (#33)
Browse files Browse the repository at this point in the history
BREAKING CHANGE: minimum supported webpack version is `5`
  • Loading branch information
cap-Bernardito authored Apr 5, 2021
1 parent c048eac commit de9d1a5
Show file tree
Hide file tree
Showing 7 changed files with 59 additions and 30 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/nodejs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ jobs:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
node-version: [10.x, 12.x, 14.x]
webpack-version: [4, latest]
webpack-version: [latest]

runs-on: ${{ matrix.os }}

Expand Down
41 changes: 29 additions & 12 deletions package-lock.json

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

5 changes: 2 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,10 @@
"dist"
],
"peerDependencies": {
"webpack": "^4.0.0 || ^5.0.0"
"webpack": "^5.0.0"
},
"dependencies": {
"loader-utils": "^2.0.0",
"schema-utils": "^3.0.0"
"loader-utils": "^2.0.0"
},
"devDependencies": {
"@babel/cli": "^7.13.14",
Expand Down
10 changes: 2 additions & 8 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,12 @@
Author Tobias Koppers @sokra
*/

import { getOptions, interpolateName } from "loader-utils";
import { validate } from "schema-utils";
import { interpolateName } from "loader-utils";

import schema from "./options.json";

export default function loader(content) {
const options = getOptions(this);

validate(schema, options, {
name: "Node Loader",
baseDataPath: "options",
});
const options = this.getOptions(schema);

const name = interpolateName(
this,
Expand Down
1 change: 1 addition & 0 deletions src/options.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"title": "Node Loader options",
"type": "object",
"properties": {
"name": {
Expand Down
24 changes: 23 additions & 1 deletion test/fixtures/example/package-lock.json

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

6 changes: 1 addition & 5 deletions test/helpers/getCompiler.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,7 @@ export default (fixture, loaderOptions = {}, config = {}) => {
const compiler = webpack(fullConfig);

if (!config.outputFileSystem) {
const outputFileSystem = createFsFromVolume(new Volume());
// Todo remove when we drop webpack@4 support
outputFileSystem.join = path.join.bind(path);

compiler.outputFileSystem = outputFileSystem;
compiler.outputFileSystem = createFsFromVolume(new Volume());
}

return compiler;
Expand Down

0 comments on commit de9d1a5

Please sign in to comment.