Skip to content

Commit

Permalink
fix: strip resource query (#58)
Browse files Browse the repository at this point in the history
* fix: strip resource query

* test: resource query test

* refactor: split by ? instead of url.parse

* chore: update lock files

Co-authored-by: Ricardo Gobbo de Souza <ricardogobbosouza@yahoo.com.br>
  • Loading branch information
privatenumber and ricardogobbosouza committed Jan 19, 2021
1 parent 2e6c8eb commit f0a2d81
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 12 deletions.
19 changes: 8 additions & 11 deletions package-lock.json

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

2 changes: 1 addition & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ export class ESLintWebpackPlugin {

// @ts-ignore
const processModule = (module) => {
const file = module.resource;
const file = module.resource.split('?')[0];

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();
});
});
});

0 comments on commit f0a2d81

Please sign in to comment.