rsnext/test/integration/react-streaming-and-server-components/app/next.config.js
Shu Ding 73928c01f1
Improve error message for importing native Node APIs in the edge runtime (#30696)
This PR improves the error message for the case that `fs` is being imported under `concurrentFeatures`. This is a common error, but the current console output isn't very clear about the cause.

The new output will be:

> Native Node.js APIs are not supported in the Edge Runtime with \`concurrentFeatures\` enabled. Found \`fs\` imported.

Related to #30424.

## Bug

- [x] Related issues linked using `fixes #number`
- [x] Integration tests added
- [ ] Errors have helpful link attached, see `contributing.md`

## Feature

- [ ] Implements an existing feature request or RFC. Make sure the feature request has been accepted for implementation before opening a PR.
- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Documentation added
- [ ] Telemetry added. In case of a feature if it's used or not.
- [ ] Errors have helpful link attached, see `contributing.md`

## Documentation / Examples

- [ ] Make sure the linting passes by running `yarn lint`
2021-11-01 11:40:21 +00:00

20 lines
548 B
JavaScript

module.exports = {
pageExtensions: ['js', 'ts', 'jsx'], // .tsx won't be treat as page,
experimental: {
reactRoot: true,
concurrentFeatures: true,
serverComponents: true,
},
webpack(config) {
const { alias } = config.resolve
alias['react/jsx-dev-runtime'] = 'react-18/jsx-dev-runtime.js'
alias['react/jsx-runtime'] = 'react-18/jsx-runtime.js'
// Use react 18
alias['react'] = 'react-18'
alias['react-dom'] = 'react-dom-18'
alias['react-dom/server'] = 'react-dom-18/server'
return config
},
}