Comments (17)
No, not yet. This issue is roughly tracking being able to add import something from 'some-package-here';
into any file in your app, and having the build system bundle that dependency into the build (with some caveats of course). We are on the path for this, but not there yet...
from rfcs.
I would be curious if there is any update about this issue. I'm trying to write an addon for ckeditor 5 and they have a multi package architecture that exposes only ES6 modules.
I tried ember-rollup
but it looks unmaintained and quite boggy. It doesn't support scoped packages so I cannot tell it to import @ckeditor/ckeditor5-editor-balloon
for instance. It requires the package.json
to have a main
source but some packages don't. And last but not least, the detection of ES6 module relies on jsnext:main
in package.json
that is far from broadly supported.
I would love to hear if anyone have a pointer how to achieve this. I don't mind doing the suggested "shim-addon + custom broccoli-funnel+babel" if that's what it takes, I'm just not very familiar with these. Thanks!
from rfcs.
One thought I've had on this is that we could add a "resolvedTree" which is merged into the vendor tree at the end.
Essentially:
- Find unknown imports in
app/addon
tree - Add a default resolver that checks for installed npm packages (possible erroring with suggested missing packages when not found?) (Allow for custom resolution strategies?)
- Add needed file(s) to the tree using rollup (allow configuration?)
- Pass the tree through babel transform (definitely allow configuration of this)
- merge with vendor
from rfcs.
I believe this is something we should make "just work".
The fun bit, is how does one support this in add-ons and nested addo-ns. E.g. the lack of a highlander node_module is the source of us never rolling ember-browserify or similar in by default.
There are some problems/solutions:
- introduce the concept of a highlander dependency (only 1 dep can exists)
- allow duping (e.g. 15 versions of mkdirp problem) or worse, pulling in 2 or more things that pollute the global incompatible ways. All while accidentally increases byte size
- this would require name mangling so that different things wont collide (ef4/ember-browserify#100 spiked this, but the lack of highlander made this unappealing)
- ??
Doing this automagically has its risks (surprise inclusions, and a more complicated implementation). I believe we should strongly consider the npm:
or similar approach as ember-browserify took. As it neatly addresses the issues.
from rfcs.
@runspired one of the things:
- ember-cli/ember-cli#5976 needs to be documented.
from rfcs.
I heard this will work for 2.14 or 2.15?
from rfcs.
We are using Ember-CLI 2.15 beta 1 because it works there (and is mentioned in the release notes).
from rfcs.
Great thx.
from rfcs.
Sounds nice. @boris-petrov which mention are you refering to though? Is it ember-cli/ember-cli#7045?
from rfcs.
@bjornharrtell - this is the PR, yes. I was talking about this, where it says #7045 Make app.import() work with files inside node_modules @Turbo87
.
from rfcs.
Isn't this RFC broader scoped though? I.e to be able to import modules statically from npm dependencies in app code? I'm often finding myself wanting that and working it around by either importing the source into the project or symlinking the source into the app dir which both are hacky and error prone.
from rfcs.
@runspired Can this be closed now that 2.15 is out, or does this issue cover something that wasn't added in 2.15?
from rfcs.
The app.import node_modules change in 2.15 helps a bunch! Here's a gist I made of how I used that for c3js/d3js: https://gist.github.com/caseywatts/347e18e4905c447859fa777ec97c34f8
It definitely seems like something that could be automated - the only difference between the two is the package name duplicated everywhere, e.g. c3
. (I like that this issue is specifically about es6 module imports - I don't mean to suggest that css imports that I have in my gist are related to this issue)
from rfcs.
https://github.com/ef4/ember-auto-import
from rfcs.
I second @karellm. Please provide reference on how to achieve this. I'm facing a hard time trying to integrate a third-party es6 library in the ember ecosystem
from rfcs.
@alansouzati I haven't tried it personally but have you considered ember-auto-import
linked above?
from rfcs.
We are working on closing the ember-cli/rfcs repo in favor of using a single central RFC's repo for everything. This was laid out in https://emberjs.github.io/rfcs/0300-rfc-process-update.html.
Sorry for the troubles, but would you mind reviewing to see if this is still something we need, and if so migrating this over to emberjs/rfcs?
from rfcs.
Related Issues (20)
- convention for specifying browser support HOT 2
- Problems with standardized targets RFC #95 and javascript HOT 23
- configurable tmp directory [Docker] HOT 5
- Dropping ember data from the default blueprint HOT 1
- Making addon dummy apps less special HOT 10
- addon entry-point other than index.js HOT 5
- Public API to examine app dependencies from an addon HOT 3
- lib/broccoli/ember-modules-app HOT 4
- Generate Babel Helpers HOT 2
- Provide a way to skip import of add-on assets HOT 5
- Breaking "bugfixes" for an eventual 3.0 HOT 1
- Access to `app.options` is inconsistent HOT 3
- Configurable paths for Tree Paths HOT 5
- I'd like to discuss Webpack HOT 4
- Better server watchers HOT 10
- Expose API to customize and/or disable colors used in terminal output. HOT 1
- We need a better teaching & learning story. HOT 8
- Don't set license in app's package.json HOT 1
- Support in-repo commands by default. HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from rfcs.