ember-fastboot / ember-fastboot/fastboot
Drop `FastBoot.require` for 3rd dependencies?
- Dominant language
- No language data
- Stars
- 155
- Forks
- 67
- PR merge metrics
- No merged PRs in 30d
Description
Hello,
according to the upcoming major release, would it make sense to drop [custom FastBoot import system](http://ember-fastboot.com/docs/user-guide#using-whitelisted-node-dependencies) and use what JavaScript has by spec?
Some benefits could be
- following the spec,
- simplifying FastBoot build process.
#### 3rd dependencies
For importing external modules from 3rd packages the [ember-auto-import](https://github.com/ef4/ember-auto-import) could be used.
1. Add dependencies as usual `npm install --save-dev ldclient-node ldclient-js`.
2. Use [dynamic import](https://github.com/ef4/ember-auto-import#dynamic-import) to conditionally import modules in FastBoot / browser.
```javascript
// simplified example
let ldclient;
if (typeof FastBoot !== 'undefined') {
ldclient = await import('ldclient-node');
} else {
ldclient = await import('ldclient-js');
}
```
#### Node.js built-in modules
`FastBoot.require` will be still used for importing Node.js builtins at runtime, however it could be marked "private", because only `ember-auto-import` should use it at compile time, add-ons/applications will use native JavaScript.
```js
// input
import os from 'os';
const os = await import('os');
// output
const os = FastBoot.require('os');
const os = await FastBoot.require('os');
```
I'm not sure if I'm missing something that could prevent from dropping `FastBoot.require` now.
Thanks
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.