Skip to content

Commit

Permalink
Update resolving of filename
Browse files Browse the repository at this point in the history
Also remove babelrc.js lookup as we do not support 7 in this version
  • Loading branch information
danez committed Mar 6, 2018
1 parent d51e635 commit 4d14079
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 13 deletions.
1 change: 1 addition & 0 deletions .gitignore
Expand Up @@ -4,3 +4,4 @@ lib
node_modules
npm-debug.log
test/output
yarn-error.log
6 changes: 1 addition & 5 deletions src/index.js
Expand Up @@ -103,11 +103,7 @@ function passMetadata(s, context, metadata) {
}

module.exports = function(source, inputSourceMap) {
// Handle filenames (#106)
const webpackRemainingChain = loaderUtils
.getRemainingRequest(this)
.split("!");
const filename = webpackRemainingChain[webpackRemainingChain.length - 1];
const filename = this.resourcePath;

// Handle options
const loaderOptions = loaderUtils.getOptions(this) || {};
Expand Down
2 changes: 1 addition & 1 deletion src/resolve-rc.js
Expand Up @@ -2,7 +2,7 @@ const path = require("path");
const exists = require("./utils/exists");

module.exports = function find(fileSystem, start) {
for (const fileName of [".babelrc", ".babelrc.js", "package.json"]) {
for (const fileName of [".babelrc", "package.json"]) {
const file = path.join(start, fileName);

if (exists(fileSystem, file)) {
Expand Down
7 changes: 0 additions & 7 deletions test/resolverc.test.js
Expand Up @@ -10,13 +10,6 @@ test("should find the .babelrc file", t => {
t.is(result, path.join(__dirname, "fixtures/babelrc-test/.babelrc"));
});

test("should find the .babelrc.js config", t => {
const start = path.join(__dirname, "fixtures/babelrc-test/1/2/5/4");
const result = resolveRc(fs, start);

t.is(result, path.join(__dirname, "fixtures/babelrc-test/1/2/5/.babelrc.js"));
});

test("should find the package.json babel config", t => {
const start = path.join(__dirname, "fixtures/package-test");
const result = resolveRc(fs, start);
Expand Down

0 comments on commit 4d14079

Please sign in to comment.