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

Make Webpack loader detection regex dramatically faster #7226

Merged
merged 2 commits into from Nov 2, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
16 changes: 16 additions & 0 deletions packages/core/integration-tests/test/resolver.js
Expand Up @@ -382,4 +382,20 @@ describe('resolver', function () {
let output = await run(b);
assert.strictEqual(output.default, 2);
});

it('should support very long dependency specifiers', async function () {
this.timeout(8000);

let inputDir = path.join(__dirname, 'input');

await outputFS.mkdirp(inputDir);
await outputFS.writeFile(
path.join(inputDir, 'index.html'),
`<img src="data:image/jpeg;base64,/9j/${'A'.repeat(200000)}">`,
);

await bundle(path.join(inputDir, 'index.html'), {
inputFS: overlayFS,
});
});
});
2 changes: 1 addition & 1 deletion packages/resolvers/default/src/DefaultResolver.js
Expand Up @@ -5,7 +5,7 @@ import NodeResolver from '@parcel/node-resolver-core';

// Throw user friendly errors on special webpack loader syntax
// ex. `imports-loader?$=jquery!./example.js`
const WEBPACK_IMPORT_REGEX = /\S+-loader\S*!\S+/g;
const WEBPACK_IMPORT_REGEX = /^\w+-loader(?:\?\S*)?!/;

export default (new Resolver({
resolve({dependency, options, specifier}) {
Expand Down