Comments (10)
TypeScript isn’t 100% there yet on ESM either, so that might be related.
I’m moving through my projects again, updating deps and adding strict types, so I’ll soon get to updating this one as well anyway!
from parse-latin.
Bundlers are very good at this. They're not confused. They are meant to deal with dependencies with different versions. Different versions isn't a problem.
For your last point, well, the problem is in the bundler. If you're using TS, that's means the problem is TS. The problems isn't nesecarily solved by updating, as your bundler still has problems with other projects using CJS in this way (which, again, is fine), but the problem is side-stepped: both packages are ESM.
from parse-latin.
The problem you describe is not the problem.
This package uses nlcst-to-string
version 2, which was CommonJS. And used module.exports
.
Are you on the latest webpack 5? Have configured it to support ESM properly?
from parse-latin.
Thanks for your quick reply.
I'm on webpack 5.61.0. That webpack pipeline is configured for ES modules, which load fine, except for the above.
I could only make it work by using the exports-loader
webpack plugin, which basically does the first fix suggested above on the fly.
I should mention that this is a standalone TypeScript project, compiling to a web worker.
Curiously, the same code compiled within an Angular project does not manifest this problem. That's why I'm saying that it happens in at least some webpack configurations.
I'm of course open to any suggestions, I'd love to get rid of the exports-loader
here.
from parse-latin.
That's great news.
I'd still play it safe, considering the plethora of possible configurations and versions (and things that can go wrong) in the wild, and import toString
as a named import in the respective plugins.
Again, many thanks for your work on these libs!
from parse-latin.
It’s impossible to use version 3 of nlcst-to-string
with a default import!
from parse-latin.
That's interesting.
I see it imported differently in retext-spell
(as a named import), than in parse-latin
(default import).
Is this a case of these libs using different versions of nlcst-to-string
?
The error mention in the OP is caused by attempting a default import where there is no default export.
I might be missing something (maybe a lot), so apologies if I'm way off track here.
from parse-latin.
Different version!
The error is not the default export in the old version, Node.js and modern bundlers support using a default export for CJS module.exports
. Some bundlers don’t though.
In the latest versions, all packages switched to named exports. Hence, to upgrade, they have to be used as named exports.
from parse-latin.
Different version!
That makes sense. In the case above, although the TS config module
is set to CommonJS
and all other modules work, I get the error above.
In the latest versions, all packages switched to named exports. Hence, to upgrade, they have to be used as named exports.
I just looked into the project dependencies for each, and retext-spell
use nlcst-to-string
version 3, while parse-latin
uses version 2.
I see how that can confuse a bundler, since parse-latin
and retext-spell
get bundled together, yet they each use a different way of importing from different versions of the same lib, plus retext-spell
ultimately depends on parse-latin
, as far as I can tell.
I suppose updating parse-latin
to use nlcst-to-string
version 3 would solve this issue, would it?
from parse-latin.
Closing as I think this was an external issue!
from parse-latin.
Related Issues (20)
- Typo in unit tests for `cp.`
- error instalar vía npm HOT 3
- Should expose tokenizeWord, tokenizeWhiteSpace, and tokenizePunctuation HOT 1
- Should expose tokenizeText, and tokenizeSource HOT 1
- Should add a mergeEtceteraAbbreviation sentence modifier HOT 1
- Deny comma as first token in a sentence
- Ignore sentence terminal markers meant as literals HOT 2
- Should allow single closing quote as initial punctuation
- Should count quotes to detect if they are part of adjacent words HOT 2
- Mistakenly categorises :email: as SymbolNode + WordNode HOT 1
- Please publish @types/parse-latin HOT 1
- Please publish @types/parse-latin
- Using custom prefix exceptions HOT 3
- mergeNonWordSentences should give precedence to preceding, rather than following, children
- Throws an incorrect error
- Should have a list depicting how the parser works HOT 1
- (maybe) Should add the slash to inner word punctuation
- Typo in API makes apostrophes not work as inter-word punctuation
- Should add Location and Position to "TextNode" and "SourceNode" HOT 2
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 parse-latin.