Skip to content

Commit

Permalink
fix: Enable CJS annotations for next.js files (#48811)
Browse files Browse the repository at this point in the history
### What?

Enable import/export annotations for next.js files.

### Why?

It's required to allow importing next.js modules from node.
`cjs-module-lexer` needs these annotations to import CJS modules.

### How?

Closes WEB-949
Fixes #48801
  • Loading branch information
kdy1 committed Apr 27, 2023
1 parent 7b66e8a commit e260adb
Show file tree
Hide file tree
Showing 11 changed files with 68 additions and 66 deletions.
2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -76,7 +76,7 @@
"@opentelemetry/api": "1.4.1",
"@svgr/webpack": "5.5.0",
"@swc/cli": "0.1.55",
"@swc/core": "1.3.51",
"@swc/core": "1.3.55",
"@swc/helpers": "0.5.1",
"@testing-library/react": "13.0.0",
"@types/cheerio": "0.22.16",
Expand Down
Expand Up @@ -12,11 +12,11 @@ PlainIssue {
ident: "[project]/packages/next/dist/server/lib/mock-request.js",
},
start: SourcePos {
line: 21,
line: 26,
column: 56,
},
end: SourcePos {
line: 21,
line: 26,
column: 73,
},
},
Expand Down
Expand Up @@ -12,11 +12,11 @@ PlainIssue {
ident: "[project]/packages/next/dist/server/api-utils/node.js",
},
start: SourcePos {
line: 25,
line: 30,
column: 17,
},
end: SourcePos {
line: 25,
line: 30,
column: 34,
},
},
Expand Down
Expand Up @@ -12,11 +12,11 @@ PlainIssue {
ident: "[project]/packages/next/dist/server/api-utils/node.js",
},
start: SourcePos {
line: 149,
line: 154,
column: 20,
},
end: SourcePos {
line: 149,
line: 154,
column: 42,
},
},
Expand Down
Expand Up @@ -12,11 +12,11 @@ PlainIssue {
ident: "[project]/packages/next/dist/server/crypto-utils.js",
},
start: SourcePos {
line: 18,
line: 22,
column: 56,
},
end: SourcePos {
line: 18,
line: 22,
column: 73,
},
},
Expand Down
Expand Up @@ -12,11 +12,11 @@ PlainIssue {
ident: "[project]/packages/next/dist/server/api-utils/node.js",
},
start: SourcePos {
line: 25,
line: 30,
column: 17,
},
end: SourcePos {
line: 25,
line: 30,
column: 34,
},
},
Expand Down
Expand Up @@ -12,11 +12,11 @@ PlainIssue {
ident: "[project]/packages/next/dist/server/crypto-utils.js",
},
start: SourcePos {
line: 18,
line: 22,
column: 56,
},
end: SourcePos {
line: 18,
line: 22,
column: 73,
},
},
Expand Down
Expand Up @@ -12,11 +12,11 @@ PlainIssue {
ident: "[project]/packages/next/dist/server/api-utils/node.js",
},
start: SourcePos {
line: 149,
line: 154,
column: 20,
},
end: SourcePos {
line: 149,
line: 154,
column: 42,
},
},
Expand Down
Expand Up @@ -12,11 +12,11 @@ PlainIssue {
ident: "[project]/packages/next/dist/server/lib/mock-request.js",
},
start: SourcePos {
line: 21,
line: 26,
column: 56,
},
end: SourcePos {
line: 21,
line: 26,
column: 73,
},
},
Expand Down
2 changes: 2 additions & 0 deletions packages/next/taskfile-swc.js
Expand Up @@ -32,6 +32,7 @@ module.exports = function (task) {
module: {
type: esm ? 'es6' : 'commonjs',
ignoreDynamic: true,
exportInteropAnnotation: true,
},
env: {
targets: MODERN_BROWSERSLIST_TARGET,
Expand Down Expand Up @@ -65,6 +66,7 @@ module.exports = function (task) {
module: {
type: esm ? 'es6' : 'commonjs',
ignoreDynamic: true,
exportInteropAnnotation: true,
},
env: {
targets: {
Expand Down

0 comments on commit e260adb

Please sign in to comment.