Skip to content

Commit

Permalink
Remove dependency on loader-utils
Browse files Browse the repository at this point in the history
  • Loading branch information
nied authored and JLHwung committed Oct 23, 2022
1 parent df28fe3 commit bc0145b
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 9 deletions.
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
},
"dependencies": {
"find-cache-dir": "^3.3.1",
"loader-utils": "^2.0.0",
"make-dir": "^3.1.0",
"schema-utils": "^2.6.5"
},
Expand Down
4 changes: 1 addition & 3 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ const injectCaller = require("./injectCaller");
const schema = require("./schema");

const { isAbsolute } = require("path");
const loaderUtils = require("loader-utils");
const validateOptions = require("schema-utils");

function subscribe(subscriber, metadata, context) {
Expand Down Expand Up @@ -55,8 +54,7 @@ function makeLoader(callback) {
async function loader(source, inputSourceMap, overrides) {
const filename = this.resourcePath;

let loaderOptions = loaderUtils.getOptions(this);

let loaderOptions = this.getOptions();
validateOptions(schema, loaderOptions, {
name: "Babel loader",
});
Expand Down
10 changes: 8 additions & 2 deletions test/options.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,11 @@ const globalConfig = {
rules: [
{
test: /\.jsx?/,
use: babelLoader,
loader: babelLoader,
exclude: /node_modules/,
options: {
presets: ["@babel/env"],
},
},
],
},
Expand All @@ -42,8 +45,11 @@ test.cb("should interpret options given to the loader", t => {
rules: [
{
test: /\.jsx?/,
use: babelLoader + "?presets[]=@babel/env",
loader: babelLoader,
exclude: /node_modules/,
options: {
presets: ["@babel/env"],
},
},
],
},
Expand Down
10 changes: 8 additions & 2 deletions test/sourcemaps.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,11 @@ test.cb("should output webpack's sourcemap", t => {
rules: [
{
test: /\.jsx?/,
use: babelLoader + "?presets[]=@babel/env",
loader: babelLoader,
exclude: /node_modules/,
options: {
presets: ["@babel/env"],
},
},
],
},
Expand Down Expand Up @@ -147,8 +150,11 @@ test.cb("should output webpack's devtoolModuleFilename option", t => {
rules: [
{
test: /\.jsx?/,
use: babelLoader + "?presets[]=@babel/env",
loader: babelLoader,
exclude: /node_modules/,
options: {
presets: ["@babel/env"],
},
},
],
},
Expand Down
1 change: 0 additions & 1 deletion yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2143,7 +2143,6 @@ __metadata:
find-cache-dir: ^3.3.1
husky: ^4.3.0
lint-staged: ^10.5.1
loader-utils: ^2.0.0
make-dir: ^3.1.0
nyc: ^15.1.0
pnp-webpack-plugin: ^1.6.4
Expand Down

0 comments on commit bc0145b

Please sign in to comment.