Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added babel-plugin-dynamic-import-node #6811

Merged
merged 5 commits into from
Mar 30, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions packages/next/build/babel/preset.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,8 @@ module.exports = (api: any, options: NextBabelPresetOptions = {}): BabelPreset =
plugins: [
require('babel-plugin-react-require'),
require('@babel/plugin-syntax-dynamic-import'),
// Transform dynamic import to require
isTest && require('babel-plugin-dynamic-import-node'),
require('./plugins/react-loadable-plugin'),
[require('@babel/plugin-proposal-class-properties'), options['class-properties'] || {}],
require('@babel/plugin-proposal-object-rest-spread'),
Expand Down
1 change: 1 addition & 0 deletions packages/next/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@
"autodll-webpack-plugin": "0.4.2",
"babel-core": "7.0.0-bridge.0",
"babel-loader": "8.0.2",
"babel-plugin-dynamic-import-node": "2.2.0",
"babel-plugin-react-require": "3.0.0",
"babel-plugin-transform-react-remove-prop-types": "0.4.15",
"chalk": "2.4.2",
Expand Down
4 changes: 3 additions & 1 deletion test/lib/next-test-utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -116,8 +116,10 @@ export function runNextCommand (argv, options = {}) {

export function runNextCommandDev (argv, stdOut) {
const cwd = path.dirname(require.resolve('next/package'))
const env = { ...process.env, NODE_ENV: undefined }

return new Promise((resolve, reject) => {
const instance = spawn('node', ['dist/bin/next', ...argv], { cwd })
const instance = spawn('node', ['dist/bin/next', ...argv], { cwd, env })

function handleStdout (data) {
const message = data.toString()
Expand Down
7 changes: 7 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2532,6 +2532,13 @@ babel-messages@^6.23.0:
dependencies:
babel-runtime "^6.22.0"

babel-plugin-dynamic-import-node@2.2.0:
version "2.2.0"
resolved "https://registry.yarnpkg.com/babel-plugin-dynamic-import-node/-/babel-plugin-dynamic-import-node-2.2.0.tgz#c0adfb07d95f4a4495e9aaac6ec386c4d7c2524e"
integrity sha512-fP899ELUnTaBcIzmrW7nniyqqdYWrWuJUyPWHxFa/c7r7hS6KC8FscNfLlBNIoPSc55kYMGEEKjPjJGCLbE1qA==
dependencies:
object.assign "^4.1.0"

babel-plugin-istanbul@^4.1.6:
version "4.1.6"
resolved "https://registry.yarnpkg.com/babel-plugin-istanbul/-/babel-plugin-istanbul-4.1.6.tgz#36c59b2192efce81c5b378321b74175add1c9a45"
Expand Down