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

Skip external import's from processing #2380

Merged
merged 1 commit into from Dec 11, 2018
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
2 changes: 2 additions & 0 deletions packages/core/parcel-bundler/src/visitors/dependencies.js
Expand Up @@ -54,6 +54,8 @@ module.exports = {
types.isStringLiteral(args[0]);

if (isDynamicImport) {
if (isURL(args[0].value)) return;

asset.addDependency('_bundle_loader');
addDependency(asset, args[0], {dynamic: true});

Expand Down
@@ -0,0 +1,5 @@
const lodash = import('https://cdnjs.cloudflare.com/ajax/libs/lodash.js/4.17.11/lodash.min.js');

export default function () {
return lodash.then(() => _);
};
19 changes: 19 additions & 0 deletions packages/core/parcel-bundler/test/javascript.js
Expand Up @@ -342,6 +342,25 @@ describe('javascript', function() {
assert.equal(await output(), 3);
});

it('Should not run parcel over external modules', async function() {
let b = await bundle(
path.join(__dirname, '/integration/dynamic-external/index.js'),
{
target: 'browser'
}
);

await assertBundleTree(b, {
name: 'index.js',
assets: ['index.js'],
childBundles: [
{
type: 'map'
}
]
});
});

it('should support bundling workers', async function() {
let b = await bundle(path.join(__dirname, '/integration/workers/index.js'));

Expand Down