Comments (2)
I claim no responsibility for what webpack does :| But you can configure it to compile certain modules in node_modules.
Granted that last time I wrote that part in the package.json for this library it wasn't clear at all what the "module"
property would have implied, as it is you can do this:
import shareThis from 'https://cdn.jsdelivr.net/npm/share-this/src/core.js';
and that would work perfectly fine.
But I guess I'll look into what's rolling now for those package.json properties, and serve a single file compiled for ES6 in "module"
...
from share-this.
I claim no responsibility for what webpack does
To clarify, it's not just webpack, any "standard" bundler implementation where we use import ... from ...
will behave this way. It's even mentioned in the Node.js docs https://nodejs.org/api/esm.html#esm_dual_commonjs_es_module_packages
Prior to the introduction of support for ES modules in Node.js, it was a common pattern for package authors to include both CommonJS and ES module JavaScript sources in their package, with package.json "main" specifying the CommonJS entry point and package.json "module" specifying the ES module entry point. This enabled Node.js to run the CommonJS entry point while build tools such as bundlers used the ES module entry point, since Node.js ignored (and still ignores) the top-level "module" field.
So from this point of view, the use of "module"
is not correct, it should be "exports"
. But it's the de-facto way with bundlers.
Also, the bug I have reported here is the problem node.js docs call "dual package hazard": https://nodejs.org/api/esm.html#esm_dual_package_hazard.
So what I've suggested with option 2), removing the "module"
bit sounds like the best option. Or it could be changed to "exports"
.
from share-this.
Related Issues (20)
- How to change append selector? HOT 1
- Source map support HOT 1
- LinkedIn not pulling in data HOT 2
- Cannot read property 'getSelection' of undefined when unmounting React component HOT 1
- Latest release(1.3.0) is a breaking change. HOT 2
- Library name change HOT 3
- Move the sharers to seperate packages
- More control over where the popup appears
- whatsapp HOT 1
- controlling when not to pop
- Popover text not showing
- Disabling this as a user HOT 1
- cannot change the background color of the popup HOT 5
- Sharers not available in window object
- Facebook sharer error HOT 2
- Translate HOT 3
- Does not work properly on iPhone HOT 5
- controlling when to pop and when not ( based on selected text char length ) HOT 2
- need help
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 share-this.