Skip to content

Commit a7d6ccd

Browse files
committed
docs(config): added type : "module" to the package.json in getting started section section
The getting started doc's package.json was missing `type:"module"` setting. Because of that the users following the docs get error at the import statements.
1 parent 35023e3 commit a7d6ccd

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/content/guides/getting-started.mdx

+4
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ contributors:
2727
- d3lm
2828
- snitin315
2929
- Etheryen
30+
- RajeevPullat
3031
---
3132

3233
Webpack is used to compile JavaScript modules. Once [installed](/guides/installation), you can interact with webpack either from its [CLI](/api/cli) or [API](/api/node). If you're still new to webpack, please read through the [core concepts](/concepts) and [this comparison](/comparison) to learn why you might use it over the other tools that are out in the community.
@@ -111,6 +112,7 @@ T> If you want to learn more about the inner workings of `package.json`, then we
111112
"description": "",
112113
- "main": "index.js",
113114
+ "private": true,
115+
+ "type": "module",
114116
"scripts": {
115117
"test": "echo \"Error: no test specified\" && exit 1"
116118
},
@@ -134,6 +136,8 @@ There are problems with managing JavaScript projects this way:
134136

135137
Let's use webpack to manage these scripts instead.
136138

139+
T> The `type: module` in the package.json is required to enable ES module import statements in .js files by telling Node.js to treat them as ES modules instead of the default CommonJS modules.
140+
137141
## Creating a Bundle
138142

139143
First we'll tweak our directory structure slightly, separating the "source" code (`./src`) from our "distribution" code (`./dist`). The "source" code is the code that we'll write and edit. The "distribution" code is the minimized and optimized `output` of our build process that will eventually be loaded in the browser. Tweak the directory structure as follows:

0 commit comments

Comments
 (0)