-
EnvironmentBluepring v3, Core QuestionI see that by default Webpack is not using type script version of the blueprint but esm output of that Is it possible to consume typescript version of the library from node_modules? If not @blueprint npm/yarn package but the source is used what is the best practice to connect it to a project? |
Beta Was this translation helpful? Give feedback.
Replies: 5 comments
-
You should not consume the typescript You should consume Blueprint (and any other TS-authored library) through its |
Beta Was this translation helpful? Give feedback.
-
Thank you for the fast reply. My question comes from having a similar issue #4112 (comment) Case: Type Script is used, Babel isn't used, Webpack is used, arbitrary 3d party libraries are used. Solutions I have:
Both solutions are not looking good. What would be your recommendation? |
Beta Was this translation helpful? Give feedback.
-
Why do you need the es2017 version of Blueprint? Why not use the contents of the |
Beta Was this translation helpful? Give feedback.
-
Now that you asking, I'm suspicious if I did something wrong last time.
Are you saying that I should add "module" field to the package.json of my project? |
Beta Was this translation helpful? Give feedback.
-
No, sorry if this was unclear. The "module" field is specified by the libraries you depend on, like
It should "just work" out of the box with latest webpack. It depends on the rest of your build system and configuration. Are you using create-react-app? Do you have a repo on github you can demo with? |
Beta Was this translation helpful? Give feedback.
You should not consume the typescript
.ts
source files of Blueprint published in the NPM package. Those are for source mapping only (in debugging contexts).You should consume Blueprint (and any other TS-authored library) through its
.js
and.d.ts
files. Blueprint happens to provide.js
files in multiple module formats, as you can see in thelib/
folder. Choose the one which is most appropriate for your module loader. For example, recent versions of webpack support ES module syntax, so you should use thelib/esm/
folder. This path is specified by the"module"
field inpackage.json
, which webpack uses by convention.