Skip to content

Commit

Permalink
Resolve extensions in Turbo-compatible way
Browse files Browse the repository at this point in the history
  • Loading branch information
wojtekmaj committed Jul 4, 2024
1 parent 574a324 commit 3abef0f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 13 deletions.
12 changes: 4 additions & 8 deletions sample/next-app/next.config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
/** @type {import('next').NextConfig} */
const nextConfig = {
experimental: {
// You may not need this, it's just to support moduleResolution: 'node16'
extensionAlias: {
'.js': ['.tsx', '.ts', '.jsx', '.js'],
},
turbo: {
resolveAlias: {
// Turbopack does not support standard ESM import paths yet
Expand All @@ -18,14 +22,6 @@ const nextConfig = {
* See https://github.com/vercel/next.js/pull/66817
*/
swcMinify: false,
webpack: (config) => {
// You may not need this, it's just to support moduleResolution: 'node16'
config.resolve.extensionAlias = {
'.js': ['.js', '.ts', '.tsx'],
};

return config;
},
};

export default nextConfig;
9 changes: 4 additions & 5 deletions sample/next-pages/next.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ const nextConfig = {
* Critical: prevents "ESM packages (pdfjs-dist/build/pdf.worker.min.mjs) need to be imported." error
*/
esmExternals: 'loose',
// You may not need this, it's just to support moduleResolution: 'node16'
extensionAlias: {
'.js': ['.tsx', '.ts', '.jsx', '.js'],
},
turbo: {
resolveAlias: {
// Turbopack does not support standard ESM import paths yet
Expand All @@ -29,11 +33,6 @@ const nextConfig = {
*/
config.resolve.alias.canvas = false;

// You may not need this, it's just to support moduleResolution: 'node16'
config.resolve.extensionAlias = {
'.js': ['.js', '.ts', '.tsx'],
};

return config;
},
};
Expand Down

0 comments on commit 3abef0f

Please sign in to comment.