You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: 03-bundling/07-vite-lib/01-entrypoints/README.md
+24-11Lines changed: 24 additions & 11 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,21 +1,19 @@
1
1
# 01 Entrypoints
2
2
3
-
In this example we are going to add support for Browser and Node.js process using multiple formats (ESM, CJS, UMD) using the `package.json` metadata.
3
+
In this example we are going to create a simple mocked library as an example, and then we'll provide support for Browser (bundlers) and Node.js consumers entrypoints. This way, our lib should be properly linked from different projects using different module formats, like ESM, CJS and UMD. We will mainly configure the `package.json` metadata for that purpose. We will start from scratch, step by step.
4
4
5
-
We will start from scratch.
5
+
Summarized steps:
6
6
7
-
Summary steps:
8
-
9
-
- Create a basic library in the three formats (ESM, CJS, UMD).
7
+
- Create a basic library exposed in different module flavours: ESM, CJS and UMD.
10
8
- Add three playgrounds consuming each format.
11
9
12
10
# Steps to build it
13
11
14
12
## Mocked library
15
13
16
-
Let's start by creating the basic library in the three formats (ESM, CJS, UMD).
14
+
Let's start by creating a basic mock library in 3 different module flavours: ESM, CJS and UMD.
17
15
18
-
Add manually the `package.json`(another common approach is to use `npm init -y`):
16
+
Add manually the `package.json`like below. Another common approach is to use `npm init -y`.
19
17
20
18
_./my-lib/package.json_
21
19
@@ -82,7 +80,7 @@ _./my-lib/dist/index.umd.js_
82
80
83
81
## Playgrounds
84
82
85
-
Now, we can create three playgrounds consuming each format, let's start with the CJS format:
83
+
Now, we will create three playgrounds consuming each format. Let's start with the CJS format:
0 commit comments