Skip to content

Commit

Permalink
don't process external imports (#2380)
Browse files Browse the repository at this point in the history
  • Loading branch information
DeMoorJasper authored and devongovett committed Dec 11, 2018
1 parent 21d6cde commit 7a540fc
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 0 deletions.
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

1 comment on commit 7a540fc

@dandv
Copy link
Contributor

@dandv dandv commented on 7a540fc Dec 11, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for fixing the issue I reported! Any chance to publish a new version? Asking because I feel the ability to import packages from CDN may be an important feature to others as well. Thanks!

I'd be happy to install the package from this GitHub#commit, but neither yarn, nor npm support installing monorepo subdirs.

Please sign in to comment.