-
Notifications
You must be signed in to change notification settings - Fork 27k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* fix check in externals that validate if the require is resolve-able for the server * performance improvements Fixes #23130 ## Bug - [x] Related issues linked using `fixes #number` - [ ] Integration tests added ## Feature - [ ] Implements an existing feature request or RFC. Make sure the feature request has been accepted for implementation before opening a PR. - [x] Related issues linked using `fixes #number` - [x] Integration tests added - [ ] Documentation added - [ ] Telemetry added. In case of a feature if it's used or not. ## Documentation / Examples - [ ] Make sure the linting passes
- Loading branch information
Showing
9 changed files
with
185 additions
and
80 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
module.exports = { | ||
webpack(config) { | ||
config.resolve.alias = { | ||
...config.resolve.alias, | ||
'preact/compat': 'react', | ||
} | ||
|
||
return config | ||
}, | ||
future: { | ||
webpack5: true, | ||
}, | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
9 changes: 9 additions & 0 deletions
9
test/integration/externals/node_modules/esm-package/package.json
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
3 changes: 3 additions & 0 deletions
3
test/integration/externals/node_modules/esm-package/wrong.mjs
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import React from 'preact/compat' | ||
import World from 'esm-package/entry' | ||
|
||
export async function getStaticProps() { | ||
return { | ||
props: {}, | ||
} | ||
} | ||
|
||
export default function Index(props) { | ||
return <div>Hello {World}</div> | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import React from 'preact/compat' | ||
import World from 'esm-package/entry' | ||
|
||
export function getServerSideProps() { | ||
return {} | ||
} | ||
|
||
export default function Index(props) { | ||
return <div>Hello {World}</div> | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import React from 'preact/compat' | ||
import World from 'esm-package/entry' | ||
|
||
export default function Index(props) { | ||
return <div>Hello {World}</div> | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
/* eslint-env jest */ | ||
|
||
import fs from 'fs-extra' | ||
import { join } from 'path' | ||
import { | ||
nextBuild, | ||
findPort, | ||
nextStart, | ||
killApp, | ||
renderViaHTTP, | ||
} from 'next-test-utils' | ||
|
||
jest.setTimeout(1000 * 60 * 2) | ||
const appDir = join(__dirname, '../') | ||
let appPort | ||
let app | ||
|
||
describe('Valid resolve alias', () => { | ||
beforeAll(async () => { | ||
await fs.remove(join(appDir, '.next')) | ||
await nextBuild(appDir) | ||
appPort = await findPort() | ||
app = await nextStart(appDir, appPort) | ||
}) | ||
afterAll(() => killApp(app)) | ||
|
||
it('should render the static page', async () => { | ||
const html = await renderViaHTTP(appPort, '/static') | ||
expect(html).toMatch(/Hello <!-- -->World/) | ||
}) | ||
|
||
it('should render the ssr page', async () => { | ||
const html = await renderViaHTTP(appPort, '/ssr') | ||
expect(html).toMatch(/Hello <!-- -->World/) | ||
}) | ||
|
||
it('should render the ssg page', async () => { | ||
const html = await renderViaHTTP(appPort, '/ssg') | ||
expect(html).toMatch(/Hello <!-- -->World/) | ||
}) | ||
}) |