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

fix: strip resource query #58

Merged
merged 4 commits into from
Jan 19, 2021
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { isAbsolute, join } from 'path';
import { parse } from 'url';

import arrify from 'arrify';
import micromatch from 'micromatch';
Expand Down Expand Up @@ -80,7 +81,7 @@ export class ESLintWebpackPlugin {

// @ts-ignore
const processModule = (module) => {
const file = module.resource;
const file = parse(module.resource).pathname;
privatenumber marked this conversation as resolved.
Show resolved Hide resolved

if (
file &&
Expand Down
2 changes: 2 additions & 0 deletions test/fixtures/query-entry.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
// eslint-disable-next-line import/no-unresolved
require('./good.js?some-query=1234.js');
15 changes: 15 additions & 0 deletions test/query.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import pack from './utils/pack';

describe('query', () => {
it('should correctly resolve file despite query path', (done) => {
const compiler = pack('query');

compiler.run((err, stats) => {
expect(err).toBeNull();
expect(stats.hasWarnings()).toBe(false);
expect(stats.hasErrors()).toBe(false);

done();
});
});
});