docs: updated getting started guide to correct webpack config file extension to support CJS syntax#7518
Closed
RajeevPullat wants to merge 2 commits intowebpack:mainfrom
Closed
Conversation
…ension to support CJS syntax The docs used import statement in index.js which requires setting `type: "module"`. There is a PR for the same `https://github.com/webpack/webpack.js.org/pull/7516`. This is to correct the webpack config file. The commonjs code won't work in *.js extension. So its changed to *.cjs.
|
@RajeevPullat is attempting to deploy a commit to the Webpack Docs Team on Vercel. A member of the Team first needs to authorize it. |
|
@RajeevPullat sir, did you fix the lint check ? could you please review my pr once #7513 |
| |- package.json | ||
| |- package-lock.json | ||
| + |- webpack.config.js | ||
| + |- webpack.config.cjs |
Member
There was a problem hiding this comment.
Can we provide two examples here - for CommonJS and ECMA modules format?
| ``` | ||
|
|
||
| T> If a `webpack.config.js` is present, the `webpack` command picks it up by default. We use the `--config` option here only to show that you can pass a configuration of any name. This will be useful for more complex configurations that need to be split into multiple files. | ||
| T> By default, if you run the webpack command without specifying a configuration file, Webpack will look for certain default filenames. These typically include: `webpack.config.js` (for CommonJS format in JavaScript), `webpack.config.cjs` (for explicit CommonJS format) or `webpack.config.mjs` (for ES Modules). We use the `--config` option here only to show that you can pass a configuration of any name. This will be useful for more complex configurations that need to be split into multiple files. |
Member
|
I'll move this PR to #7677 |
4 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Updated getting started guide to correct webpack config file extension to support CJS syntax
The docs used import statement in index.js which requires setting
type: "module". There is a PR raised for the same PR:7516. This PR to correct the webpack config file extension. The CommonJS code won't work in *.js extension and will throw below error.So its best changed to
webpack.config.cjs.