Closed edsonjab closed 2 years ago
This doesn't appear to have fixed the issues
Error [ERR_REQUIRE_ESM]: Must use import to load ES Module: /Users/jkelly/dev/plaid-dot-com/node_modules/lodash-es/lodash.js
require() of ES modules is not supported.
require() of /Users/jkelly/dev/plaid-dot-com/node_modules/lodash-es/lodash.js from /Users/jkelly/dev/plaid-dot-com/node_modules/@segment/consent-manager/commonjs/consent-manager-builder/fetch-destinations.js is an ES module file as it is a .js file whose nearest parent package.json contains "type": "module" which defines all .js files in that package scope as ES modules.
Instead rename lodash.js to end in .cjs, change the requiring code to use import(), or remove "type": "module" from /Users/jkelly/dev/plaid-dot-com/node_modules/lodash-es/package.json.
at new NodeError (internal/errors.js:322:7)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1102:13)
at Module.load (internal/modules/cjs/loader.js:950:32)
at Function.Module._load (internal/modules/cjs/loader.js:790:12)
at Module.require (internal/modules/cjs/loader.js:974:19)
at require (internal/modules/cjs/helpers.js:101:18)
at Object.<anonymous> (/Users/jkelly/dev/plaid-dot-com/node_modules/@segment/consent-manager/commonjs/consent-manager-builder/fetch-destinations.js:43:19)
at Module._compile (internal/modules/cjs/loader.js:1085:14)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1114:10)
at Module.load (internal/modules/cjs/loader.js:950:32) {
type: 'NodeError',
code: 'ERR_REQUIRE_ESM'
}
make: *** [build] Error 1
Same here
Server Error
Error: require() of ES Module /Users/sephi/dev/frontend-hnf-v2/node_modules/lodash-es/lodash.js from /Users/sephi/dev/frontend-hnf-v2/node_modules/@segment/consent-manager/commonjs/consent-manager-builder/fetch-destinations.js not supported.
Instead change the require of lodash.js in /Users/sephi/dev/frontend-hnf-v2/node_modules/@segment/consent-manager/commonjs/consent-manager-builder/fetch-destinations.js to a dynamic import() which is available in all CommonJS modules.
This error happened while generating the page. Any console logs will be displayed in the terminal window.
Call Stack
Object.<anonymous>
../../src/consent-manager-builder/fetch-destinations.ts (2:0)
Object.<anonymous>
../../src/consent-manager-builder/index.tsx (3:0)
Object.<anonymous>
../src/index.ts (1:0)
Object.@segment/consent-manager
file:///Users/sephi/dev/frontend-hnf-v2/.next/server/pages/_app.js (1217:18)
__webpack_require__
file:///Users/sephi/dev/frontend-hnf-v2/.next/server/webpack-runtime.js (33:42)
eval
webpack-internal:///./src/components/cookie/banner.tsx (12:82)
Function.__webpack_require__.a
file:///Users/sephi/dev/frontend-hnf-v2/.next/server/webpack-runtime.js (97:13)
Release will fix #238