First up - love love love love this project and I want to thank you personally for the ES6 version as I just learned about it's existence last night. I had a question and it may require some background from you to help educate me :) but know I really appreciate your time. As someone with minimal OSS time these days myself I understand the weight of each question/ PR/ issue.
I noticed the ES6 import statements in this project (the ES6 version) have a suffix/ or extension of .js but all other ES6 modules I look at in react/ ember / angular do not include this.
`import baseGetTag from './.internal/baseGetTag.js'
Any particular reason why this is the way it is today? Are you open to a PR/ or some modified build (publish?) step to truncate that .js extension (from import statements) ?
A little background for you - as I'm not just out here bike shedding believe it or not :)
I work primarily to widen the adoption of redux in the emberJS ecosystem. As part of this effort I author a number of shims required to make library XYZ ember-cli friendly. I was tackling the work required to compile the flow source for redux-offline / which then required a dependency shim for redux-persist - which later required a dependency shim for this library (lodash-es). My custom build takes the ES6 source and compiles it to named AMD (on the fly) for ember-cli compatibility. All good for everything up to this point ... until I looked at the AMD output and saw it was having a hard time with the .js extension (found in the import statements of lodash-es).
Example:
isPlainObject includes a requirement for baseGetTag (at the top by way of an import)
import baseGetTag from './.internal/baseGetTag.js'
The compiled AMD looks like this (notice the trailing .js)
define('lodash/isPlainObject', ['exports', 'lodash/_baseGetTag.js'
Then, when I look at the baseGetTag definition ... to my surprise it looks like this
define('lodash/_baseGetTag', ['exports'
I could work around this/ or hack something but it got me asking if I was spending time on the right thing. As I don't see any other ES6 module using the .js extension for imports I wanted to ask if we could remove it or alter the build process that produces this to omit it.
Thoughts? Again - really appreciate this great community project!
Hi @toranb!
The file extension is required for loading esm in the browser. Try it with Safari Technical Preview.
@jdalton ah well that makes sense :) thanks for the quick reply!
for now I've worked around this on the emberJS side of the world (for anyone who might find this later)
https://github.com/ember-redux/ember-lodash-es-shim/commit/baec3fe72346f687e20ce6e409d407ee6093976e
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
Most helpful comment
Hi @toranb!
The file extension is required for loading esm in the browser. Try it with Safari Technical Preview.