Answer the question
In order to leave comments, you need to log in
How to correctly build an NPM library from ES6 classes?
I am writing a simple library now. Using the syntax of Classes, Imports, and ASYNC/AWAIT
Set up Webpack and Babel. What am I confused about:
Answer the question
In order to leave comments, you need to log in
My mistake was that I tried to add @babel/plugin-transform-runtime to the project build. And it was necessary to put in the library and collect with him. Therefore, the test fell on the project due to the fact that webpack / babel usually excludes plug-in libraries. The plugin added 5Kb and it became not 10 but 15 - everything is better than 55...
Maybe there is no use of Webpack or Babel at all.
package.json
the entry point, specify not main
, but be done module
with it. But will the parent project then understand that this import will need to be additionally transpiled? In it, the babel is used ...
exclude
, so as not to climb into node_modules
. cli
- there are special settings for this ( transpileDependencies
).
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question