You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When I am try import cjs like
const withSerwistInit = require("@serwist/next");
I got a error
Error [ERR_REQUIRE_ESM]: require() of ES Module /workspaces/sandbox/node_modules/pretty-bytes/index.js from /workspaces/sandbox/node_modules/@serwist/build/dist/index.old.cjs not supported.
Instead change the require of index.js in /workspaces/sandbox/node_modules/@serwist/build/dist/index.old.cjs to a dynamic import() which is available in all CommonJS modules.
Expected behavior
Regular build
Screenshots (if relevant)
No response
Additional information (if relevant)
No response
The text was updated successfully, but these errors were encountered:
Provide environment information
@serwist/next@8.0.3
Which project is this issue for?
@serwist/next
Link to reproduction - Issues with a link to complete (but minimal) reproduction code help us address them faster
https://codesandbox.io/p/devbox/eloquent-kate-26hzzz?layout=%257B%2522sidebarPanel%2522%253A%2522EXPLORER%2522%252C%2522rootPanelGroup%2522%253A%257B%2522direction%2522%253A%2522horizontal%2522%252C%2522contentType%2522%253A%2522UNKNOWN%2522%252C%2522type%2522%253A%2522PANEL_GROUP%2522%252C%2522id%2522%253A%2522ROOT_LAYOUT%2522%252C%2522panels%2522%253A%255B%257B%2522type%2522%253A%2522PANEL_GROUP%2522%252C%2522contentType%2522%253A%2522UNKNOWN%2522%252C%2522direction%2522%253A%2522vertical%2522%252C%2522id%2522%253A%2522clq5cq35i00093b6r2phk3uh3%2522%252C%2522sizes%2522%253A%255B70%252C30%255D%252C%2522panels%2522%253A%255B%257B%2522type%2522%253A%2522PANEL_GROUP%2522%252C%2522contentType%2522%253A%2522EDITOR%2522%252C%2522direction%2522%253A%2522horizontal%2522%252C%2522id%2522%253A%2522EDITOR%2522%252C%2522panels%2522%253A%255B%257B%2522type%2522%253A%2522PANEL%2522%252C%2522contentType%2522%253A%2522EDITOR%2522%252C%2522id%2522%253A%2522clq5cq35h00023b6rt4lzp68k%2522%257D%255D%257D%252C%257B%2522type%2522%253A%2522PANEL_GROUP%2522%252C%2522contentType%2522%253A%2522SHELLS%2522%252C%2522direction%2522%253A%2522horizontal%2522%252C%2522id%2522%253A%2522SHELLS%2522%252C%2522panels%2522%253A%255B%257B%2522type%2522%253A%2522PANEL%2522%252C%2522contentType%2522%253A%2522SHELLS%2522%252C%2522id%2522%253A%2522clq5cq35h00063b6rwfki12rr%2522%257D%255D%252C%2522sizes%2522%253A%255B100%255D%257D%255D%257D%252C%257B%2522type%2522%253A%2522PANEL_GROUP%2522%252C%2522contentType%2522%253A%2522DEVTOOLS%2522%252C%2522direction%2522%253A%2522vertical%2522%252C%2522id%2522%253A%2522DEVTOOLS%2522%252C%2522panels%2522%253A%255B%257B%2522type%2522%253A%2522PANEL%2522%252C%2522contentType%2522%253A%2522DEVTOOLS%2522%252C%2522id%2522%253A%2522clq5cq35h00083b6ryjyal06n%2522%257D%255D%252C%2522sizes%2522%253A%255B100%255D%257D%255D%252C%2522sizes%2522%253A%255B50%252C50%255D%257D%252C%2522tabbedPanels%2522%253A%257B%2522clq5cq35h00023b6rt4lzp68k%2522%253A%257B%2522id%2522%253A%2522clq5cq35h00023b6rt4lzp68k%2522%252C%2522tabs%2522%253A%255B%255D%257D%252C%2522clq5cq35h00083b6ryjyal06n%2522%253A%257B%2522tabs%2522%253A%255B%257B%2522id%2522%253A%2522clq5cq35h00073b6rdm9bxsyu%2522%252C%2522mode%2522%253A%2522permanent%2522%252C%2522type%2522%253A%2522TASK_PORT%2522%252C%2522taskId%2522%253A%2522dev%2522%252C%2522port%2522%253A3000%252C%2522path%2522%253A%2522%252F%2522%257D%255D%252C%2522id%2522%253A%2522clq5cq35h00083b6ryjyal06n%2522%252C%2522activeTabId%2522%253A%2522clq5cq35h00073b6rdm9bxsyu%2522%257D%252C%2522clq5cq35h00063b6rwfki12rr%2522%253A%257B%2522tabs%2522%253A%255B%257B%2522id%2522%253A%2522clq5cq35h00033b6rmkg06pgy%2522%252C%2522mode%2522%253A%2522permanent%2522%252C%2522type%2522%253A%2522TASK_LOG%2522%252C%2522taskId%2522%253A%2522dev%2522%257D%252C%257B%2522id%2522%253A%2522clq5cq35h00043b6rv4z80cli%2522%252C%2522mode%2522%253A%2522permanent%2522%252C%2522type%2522%253A%2522TASK_LOG%2522%252C%2522taskId%2522%253A%2522start%2522%257D%252C%257B%2522id%2522%253A%2522clq5cq35h00053b6rc94ys9ea%2522%252C%2522mode%2522%253A%2522permanent%2522%252C%2522type%2522%253A%2522TASK_LOG%2522%252C%2522taskId%2522%253A%2522install%2522%257D%255D%252C%2522id%2522%253A%2522clq5cq35h00063b6rwfki12rr%2522%252C%2522activeTabId%2522%253A%2522clq5cq35h00033b6rmkg06pgy%2522%257D%257D%252C%2522showDevtools%2522%253Atrue%252C%2522showShells%2522%253Atrue%252C%2522showSidebar%2522%253Atrue%252C%2522sidebarPanelSize%2522%253A15%257D
To reproduce
in next.config.js
const withSerwistInit = require("@serwist/next");
const withSerwist = withSerwistInit({
cacheOnFrontEndNav: true,
swSrc: "app/sw.ts",
swDest: "public/sw.js",
});
/** @type {import("next").NextConfig} */
const nextConfig = {
reactStrictMode: true,
};
module.exports = withSerwist(nextConfig);
num run build
Describe the bug
When I am try import cjs like
const withSerwistInit = require("@serwist/next");
I got a error
Error [ERR_REQUIRE_ESM]: require() of ES Module /workspaces/sandbox/node_modules/pretty-bytes/index.js from /workspaces/sandbox/node_modules/@serwist/build/dist/index.old.cjs not supported.
Instead change the require of index.js in /workspaces/sandbox/node_modules/@serwist/build/dist/index.old.cjs to a dynamic import() which is available in all CommonJS modules.
Expected behavior
Regular build
Screenshots (if relevant)
No response
Additional information (if relevant)
No response
The text was updated successfully, but these errors were encountered: