mirror of
https://github.com/reactjs/react.dev.git
synced 2026-02-21 19:31:57 +00:00
Remove 'esquery' hack to potentially enable Turbopack (#8115)
* Remove esquery hack * Add comment explaining next.config change
This commit is contained in:
@@ -36,6 +36,14 @@ const nextConfig = {
|
||||
// Don't bundle the shim unnecessarily.
|
||||
config.resolve.alias['use-sync-external-store/shim'] = 'react';
|
||||
|
||||
// ESLint depends on the CommonJS version of esquery,
|
||||
// but Webpack loads the ESM version by default. This
|
||||
// alias ensures the correct version is used.
|
||||
//
|
||||
// More info:
|
||||
// https://github.com/reactjs/react.dev/pull/8115
|
||||
config.resolve.alias['esquery'] = 'esquery/dist/esquery.min.js';
|
||||
|
||||
const {IgnorePlugin, NormalModuleReplacementPlugin} = require('webpack');
|
||||
config.plugins.push(
|
||||
new NormalModuleReplacementPlugin(
|
||||
|
||||
@@ -21,13 +21,6 @@ const getCodeMirrorPosition = (
|
||||
|
||||
const linter = new Linter();
|
||||
|
||||
// HACK! Eslint requires 'esquery' using `require`, but there's no commonjs interop.
|
||||
// because of this it tries to run `esquery.parse()`, while there's only `esquery.default.parse()`.
|
||||
// This hack places the functions in the right place.
|
||||
const esquery = require('esquery');
|
||||
esquery.parse = esquery.default?.parse;
|
||||
esquery.matches = esquery.default?.matches;
|
||||
|
||||
const reactRules = require('eslint-plugin-react-hooks').rules;
|
||||
linter.defineRules({
|
||||
'react-hooks/rules-of-hooks': reactRules['rules-of-hooks'],
|
||||
|
||||
Reference in New Issue
Block a user