-
Notifications
You must be signed in to change notification settings - Fork 27.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
30defea
commit dc03ccf
Showing
8 changed files
with
55 additions
and
1 deletion.
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
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,5 @@ | ||
module.exports = { | ||
experimental: { | ||
bundlePagesExternals: true, | ||
}, | ||
} |
3 changes: 3 additions & 0 deletions
3
test/integration/externals-pages-bundle/node_modules/external-package/index.js
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
6 changes: 6 additions & 0 deletions
6
test/integration/externals-pages-bundle/node_modules/external-package/package.json
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,13 @@ | ||
import { foo } from 'external-package' | ||
|
||
export async function getServerSideProps() { | ||
return { | ||
props: { | ||
foo, | ||
}, | ||
} | ||
} | ||
|
||
export default function Index({ foo }) { | ||
return <div>{foo}</div> | ||
} |
18 changes: 18 additions & 0 deletions
18
test/integration/externals-pages-bundle/test/index.test.js
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,18 @@ | ||
/* eslint-env jest */ | ||
|
||
import fs from 'fs-extra' | ||
import { join } from 'path' | ||
import { nextBuild } from 'next-test-utils' | ||
|
||
const appDir = join(__dirname, '../') | ||
|
||
describe('bundle pages externals with config.experimental.bundlePagesExternals', () => { | ||
it('should have no externals with the config set', async () => { | ||
await nextBuild(appDir, [], { stdout: true }) | ||
const output = await fs.readFile( | ||
join(appDir, '.next/server/pages/index.js'), | ||
'utf8' | ||
) | ||
expect(output).not.toContain('require("external-package")') | ||
}) | ||
}) |