parcel-bundler/parcel
View on GitHubThrow user friendly error if dynamic import isn't JS or empty
Open
#1951 opened on Aug 28, 2018
:raising_hand_woman: FeatureGood First Issue
Description
Feature request
Throw a user friendly error if someone is trying to import non JS or empty assets in async imports
Original issue
The following works fine when I run i development mode (parcel index.html)
import myModule from './src/mymodule.js'
import './some.css';
var assets = {
html : import('./module.html'),
css: import('./css.css'),
js : import("./javascript.js")
}
Promise.all([assets.html, assets.css, assets.js]).then(function(values) {
document.querySelector('.container').innerHTML = values[0];
values[2]['default'](myModule)
});
Build runs successfully(parcel build index.html), but when retrieving the build from the server I get:
Uncaught (in promise) Error: Cannot find module 'kgfs'
🤔 Expected Behavior
Should load all modules
😯 Current Behavior
caught (in promise) Error: Cannot find module 'kgfs'
🌍 Your Environment
| Software | Version(s) |
|---|---|
| Parcel | da7eeb69552a849a26f51a305f42821337bf90e5 |
| Node | 8.11.2 |
| npm/Yarn | 6.2.0 |
| Operating System | windows 10 |