Giter Club home page Giter Club logo

babel-plugin-dynamic-import-node's Introduction

babel-plugin-dynamic-import-node

Babel plugin to transpile import() to a deferred require(), for node. Matches the proposed spec.

NOTE: Babylon >= v6.12.0 is required to correctly parse dynamic imports.

NOTE: This plugin generates code compatible with Node.js. Webpack >= 2 supports import() natively, and for Webpack 1 you can use babel-plugin-dynamic-import-webpack that generates Webpack-compatible output.

Installation

npm install babel-plugin-dynamic-import-node --save-dev

Usage

Via .babelrc (Recommended)

.babelrc

{
  "plugins": ["dynamic-import-node"]
}

Options

  • noInterop - A boolean value, that if true will not interop the require calls. Useful to avoid using require('module').default on commonjs modules.
{
  "plugins": [
    ["dynamic-import-node", { "noInterop": true }]
  ]
}

Via CLI

$ babel --plugins dynamic-import-node script.js

Via Node API

require('babel-core').transform('code', {
  plugins: ['dynamic-import-node']
});

Code Example

Promise.all([
  import('./lib/import1'),
  import('./lib/import2')
 ]).then(([
   Import1,
   Import2
  ]) => {
   console.log(Import1);
   /* CODE HERE*/
  });

babel-plugin-dynamic-import-node's People

Contributors

auridevil avatar blackout314 avatar chicoxyzzy avatar ematipico avatar franjohn21 avatar goatslacker avatar greenkeeper[bot] avatar lencioni avatar ljharb avatar nicolo-ribaudo avatar simenb avatar vikr01 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

babel-plugin-dynamic-import-node's Issues

v2.3.1 introduced a breaking change

 Error: No substitution given for "_". If this is not meant to be a
                placeholder you may want to consider passing one of the following options to @babel/template:
                - { placeholderPattern: false, placeholderWhitelist: new Set(['_'])}
                - { placeholderPattern: /^_$/ }

      at metadata.placeholders.forEach.placeholder (node_modules/@babel/template/lib/populate.js:21:15)
          at Array.forEach (<anonymous>)
      at populatePlaceholders (node_modules/@babel/template/lib/populate.js:18:27)
      at arg (node_modules/@babel/template/lib/string.js:22:51)
      at arg (node_modules/@babel/template/lib/builder.js:77:14)
      at node_modules/babel-plugin-dynamic-import-node/lib/utils.js:36:89
      at PluginPass.CallExpression (node_modules/@babel/plugin-transform-modules-commonjs/lib/index.js:121:9)
      at newFn (node_modules/@babel/traverse/lib/visitors.js:179:21)
      at NodePath._call (node_modules/@babel/traverse/lib/path/context.js:55:20)
      at NodePath.call (node_modules/@babel/traverse/lib/path/context.js:42:17)
          =============
      at createDynamicImportTransform (node_modules/babel-plugin-dynamic-import-node/lib/utils.js:30:21)
      at _default (node_modules/@babel/plugin-transform-modules-commonjs/lib/index.js:22:71)
      at node_modules/@babel/helper-plugin-utils/lib/index.js:19:12
      at node_modules/@babel/core/lib/config/full.js:199:14
      at Function.<anonymous> (node_modules/@babel/core/lib/gensync-utils/async.js:26:3)
      at evaluateSync (node_modules/gensync/index.js:244:28)

Rolling back and locking into 2.3.0 resolves the issue.

1.1.0 breaks React Native

I don’t know if React Native is an intended target, but hitherto it has worked extremely well. Unfortunately, with 1.1.0, it breaks, as (somehow) we end up with an extra level of functions, with error messages like

Unknown named module: 'function () {
return require(1021 ); // 1021 = @client/session
}'

IOW it seems that (at least when building with the RN packager) we end up getting a function returning the module instead of getting the module itself.

Error Unknown plugin "dynamic-import-node" specified in "base" at 1,

node_modules/babel-core/lib/transformation/file/options/option-manager.js:180
          throw new ReferenceError(messages.get("pluginUnknown", plugin, loc, i, dirname));
          ^

ReferenceError: Unknown plugin "dynamic-import-node" specified in "base" at 1, attempted to resolve relative to "/Users/z/project/src/containers"
    at /Users/z/project/src/_server/node_modules/babel-core/lib/transformation/file/options/option-manager.js:180:17
    at Array.map (<anonymous>)
    at Function.normalisePlugins (/Users/z/project/src/_server/node_modules/babel-core/lib/transformation/file/options/option-manager.js:158:20)
    at OptionManager.mergeOptions (/Users/z/project/src/_server/node_modules/babel-core/lib/transformation/file/options/option-manager.js:234:36)
    at OptionManager.init (/Users/z/project/src/_server/node_modules/babel-core/lib/transformation/file/options/option-manager.js:368:12)
    at compile (/Users/z/project/src/_server/node_modules/babel-register/lib/node.js:103:45)
    at loader (/Users/z/project/src/_server/node_modules/babel-register/lib/node.js:144:14)
    at Object.require.extensions.(anonymous function) [as .js] (/Users/z/project/src/_server/node_modules/babel-register/lib/node.js:154:7)
    at Module.load (module.js:565:32)
    at tryModuleLoad (module.js:505:12)

require('babel-register')({ plugins: ["transform-decorators-legacy", "dynamic-import-node"], presets: ['es2015', 'stage-0', 'react'], // ignore: /scss/, extensions: [".es6", ".es", ".jsx", ".js"] });
trying to use this plugin cause i got SyntaxError: Unexpected token import on server side rendering
when trying to use webpack dynamic import in my react components

An in-range update of eslint-plugin-import is breaking the build 🚨

The devDependency eslint-plugin-import was updated from 2.16.0 to 2.17.0.

🚨 View failing branch.

This version is covered by your current version range and after updating it in your project the build failed.

eslint-plugin-import is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.

Status Details
  • continuous-integration/travis-ci/push: The Travis CI build failed (Details).

Commits

The new version differs by 61 commits.

  • 0499050 bump to v2.17.0
  • f479635 [webpack] v0.11.1
  • 8a4226d Merge pull request #1320 from bradzacher/export-ts-namespaces
  • 988e12b fix(export): Support typescript namespaces
  • 70c3679 [docs] make rule names consistent
  • 6ab25ea [Tests] skip a TS test in eslint < 4
  • 405900e [Tests] fix tests from #1319
  • 2098797 [fix] export: false positives for typescript type + value export
  • 70a59fe [fix] Fix overwriting of dynamic import() CallExpression
  • e4850df [ExportMap] fix condition for checking if block comment
  • 918567d [fix] namespace: add check for null ExportMap
  • 2d21c4c Merge pull request #1297 from echenley/ech/fix-isBuiltIn-local-aliases
  • 0ff1c83 [dev deps] lock typescript to ~, since it doesn’t follow semver
  • 40bf40a [*] [deps] update resolve
  • 28dd614 Merge pull request #1304 from bradennapier/feature/typescript-export-type

There are 61 commits in total.

See the full diff

FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

`import()` argument shouldn't be evaluated in the arrow scope

Reproduction

var babelPluginDynamicImportNode = require("babel-plugin-dynamic-import-node");
var babel = require("@babel/core");

var input = `
let i = 0;
import("./file-" + i++ + ".js");
assert(i === 1);

async function fn() {
  await import(await getSource());
}
`

var out = babel.transformSync(input, {
  configFile: false,
  plugins: [babelPluginDynamicImportNode]
});

console.log(out.code);

Output

let i = 0;
Promise.resolve().then(() => _interopRequireWildcard(require(`${"./file-" + i++ + ".js"}`)));
assert(i === 1);

async function fn() {
  await Promise.resolve().then(() => _interopRequireWildcard(require(`${await getSource()}`)));
}

As you can see in the output code, the first assertion fails because i++ is evaluated asynchronously, and the second one is a syntax error because await is inside a non-arrow function.

Proposed output

We can pass the import argument in Promise.resolve, so that it is in the correct scope:

let i = 0;
Promise.resolve(`${"./file-" + i++ + ".js"}`).then(_ => _interopRequireWildcard(require(_)));
assert(i === 1);

async function fn() {
  await Promise.resolve(`${await getSource()}`).then(_ => _interopRequireWildcard(require(_)));
}

Babel compilation using this plugin

Could you please clarify one thing. When I use babel-node with this plugin, all is okay. But if I use this plugin during babel compilation like this:

"build": "babel lib -d dist --presets es2015,stage-2"

will babel-plugin-dynamic-import-node work after compilation? I mean if for example I use dynamic import like this:

myLib.js:
import express from 'express';

index.js:

const dynamicModuleName = './my';
import(dynamicModuleName + 'Lib.js');

and compilation command:

"build": "babel index.js -d dist --presets es2015,stage-2"

Will babel-plugin-dynamic-import-node plugin compile myLib.js file during compilation or not?

An in-range update of babel-types is breaking the build 🚨

Version 6.22.0 of babel-types just got published.

Branch Build failing 🚨
Dependency babel-types
Current Version 6.21.0
Type dependency

This version is covered by your current version range and after updating it in your project the build failed.

As babel-types is a direct dependency of this project this is very likely breaking your project right now. If other packages depend on you it’s very likely also breaking them.
I recommend you give this issue a very high priority. I’m sure you can resolve this 💪


Status Details
  • continuous-integration/travis-ci/push The Travis CI build failed Details
Not sure how things should work exactly?

There is a collection of frequently asked questions and of course you may always ask my humans.


Your Greenkeeper Bot 🌴

Problem deploying on heroku

Im deploying an application to heroku that uses your plugin, and im getting the following error on execution after successful build :

ReferenceError: Unknown plugin "dynamic-import-node" specified in "/app/package.json" at 0, attempted to resolve relative to "/app"

Plugins for babel are setup like this:

"plugins": [
  "loadable-components/babel",
  "dynamic-import-node",
  "lodash"
],

In my local machine the build process works flawlessly but in heroku fails.

Thanks for any kind of help you can provide.

How should we deal with module attributes?

Babel 7.10 is going to support parsing stage-1 module attributes

await import("./package.json", { with: { type: "json" } })

Currently this plugin will transform the code above to

await Promise.resolve().then(() => _interopRequireWildcard(require("./package.json")));

where module attributes are excluded.

Given that node require supports JSON, I think the current situation is still acceptable, but only if type: "json" is the only accepted in the proposal. That said, if the spec will allow other type values in the future, we should decide

Should we skip the import node with module attributes? Since we can offer a custom plugin to transform module attributes into bundler-specific annotations, e.g. import(/* webpackChunkName: "lodash" */ 'lodash')

Or should we still treat them as those without attributes? A warning message can be printed since it may not be natively supported on node.js, but users may intend to pass the transpiled sources through bundlers which may support them via file extensions.

I don't have preference between these two solutions, or maybe we should even pursuit for an option. Other solutions are definitely welcome.

Variables in dynamic imports broken after 2.3.0

Node can no longer find my dynamic imports from version 2.3.3.

I compared the generated bundles and found this diff:
Before:

await Promise.resolve().then(() => __webpack_require__("./src/api sync recursive ^\\.\\/.*$")(`./${functionName}`));

After:

await Promise.resolve(`api/${functionName}`).then(s => __webpack_require__("./src sync recursive")(s));

This is the error produced:

Error: Cannot find module 'api/pdf'
    at webpackEmptyContext (/Users/richard/Projects/riktiga-vykort/.webpack/service/src/webpack:/src sync:2:1)

This is my source:

  const functionName = process.env.FUNCTION_NAME

  await import(
    `api/${functionName}`
  )

Invalid property of 'default'

This is index.js of babel-plugin-dynamic-import-node which I downloaded from npm, also v.1.0.2

Object.defineProperty(exports, "__esModule", {
  value: true
});

var _babelTemplate = require('babel-template');

var _babelTemplate2 = _interopRequireDefault(_babelTemplate);

var _babelPluginSyntaxDynamicImport = require('babel-plugin-syntax-dynamic-import');

var _babelPluginSyntaxDynamicImport2 = _interopRequireDefault(_babelPluginSyntaxDynamicImport);

var _babelTypes = require('babel-types');

var t = _interopRequireWildcard(_babelTypes);

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj['default'] = obj; return newObj; } }

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }

var TYPE_IMPORT = 'Import';

var buildImport = (0, _babelTemplate2['default'])('\n  Promise.resolve().then(() => require(SOURCE))\n');

exports['default'] = function () {
  return {
    inherits: _babelPluginSyntaxDynamicImport2['default'],

    visitor: {
      CallExpression: function () {
        function CallExpression(path) {
          if (path.node.callee.type === TYPE_IMPORT) {
            var importArgument = path.node.arguments[0];
            var newImport = buildImport({
              SOURCE: t.isStringLiteral(importArgument) || t.isTemplateLiteral(importArgument) ? path.node.arguments : t.templateLiteral([t.templateElement({ raw: '', cooked: '' }), t.templateElement({ raw: '', cooked: '' }, true)], path.node.arguments)
            });
            path.replaceWith(newImport);
          }
        }

        return CallExpression;
      }()
    }
  };
};

Why is it completely different than index.js here, in this repo?

Btw. the one on GitHub doesn't seem to work (still returns unexpected token), the one on npm works, but only after you add module.exports = exports["default"] at the end of index.js, otherwise babel-jest returns Plugin 1 specified in "base" provided an invalid property of "default"

Update to Babel 7

This is blocking a complete update to Babel 7 in my react app.
It is a dependency of babel-plugin-react-app, which uses babel 7

Which package to use?

Heya! I'm seeing that there are two packages, pointing to this repo, but one is v1.2.0 and the another one is v2.0.0. So which one to use and which is most recent and okey for future?

  • babel-plugin-dynamic-import-node
  • babel-plugin-transform-dynamic-import

An in-range update of babel-core is breaking the build 🚨

Version 6.22.0 of babel-core just got published.

Branch Build failing 🚨
Dependency babel-core
Current Version 6.21.0
Type devDependency

This version is covered by your current version range and after updating it in your project the build failed.

As babel-core is “only” a devDependency of this project it might not break production or downstream projects, but “only” your build or test tools – preventing new deploys or publishes.

I recommend you give this issue a high priority. I’m sure you can resolve this 💪


Status Details
  • continuous-integration/travis-ci/push The Travis CI build failed Details
Not sure how things should work exactly?

There is a collection of frequently asked questions and of course you may always ask my humans.


Your Greenkeeper Bot 🌴

Server vs. client

Hi there! This Babel plugin seems particularly useful, but we have got a question about the usage:

Is there anything to take care of when transpiling for both webpack and node as targets or is there a suggested best practice? The readme doesn't mention this use case.

Inconsistency with Webpack v4

So when using dynamic imports with Webpack v4, Webpack is now using a namespace object.

https://github.com/webpack/webpack/releases/tag/v4.0.0
https://medium.com/webpack/webpack-4-import-and-commonjs-d619d626b655

This matches what is done when you use ESM modules and you import Commonjs. You have to reference "default" now in Webpack v4 when attempting to reference module.exports. This is not the same as doing a deferred require on the server. My workaround has been to do something akin to this

const EXIFModule = await import(/* webpackChunkName: "exif-js" */ 'exif-js');
// Gets around dynamic import inconsistencies between browser and server
const EXIF = EXIFModule.default || EXIFModule;

Ideally, there would be some way to at least have a setting for this plugin to turn on namespace object dynamic imports.

missing support for query params and fragments

Matches the proposed spec.

are query params and fragments part of the spec?

repro:

await import('./index.js#test')
// throws: Cannot find module './index.js#test'
await import('./index.js?test=test')
// throws: Cannot find module './index.js?test=test'

in addition, this makes it impossible to force reimporting a module and get a fresh module record, e.g. for loading modules in tests.

Bad interaction with `babel-preset-es2015`

Adding babel-preset-es2015 along with babel-plugin-dynamic-import-node causes a bad interaction between the two that causes a failure in the compilation.

I think this may also have something to do with what the reporter is seeing in #13.

Here's the full stacktrace:

TypeError: unknown: Property value expected type of string but got null
      at Object.validate (node_modules/babel-types/lib/definitions/index.js:161:13)
      at validate (node_modules/babel-types/lib/index.js:505:9)
      at Object.builder (node_modules/babel-types/lib/index.js:466:7)
      at PluginPass.TemplateLiteral (node_modules/babel-plugin-transform-es2015-template-literals/lib/index.js:81:24)
      at newFn (node_modules/babel-traverse/lib/visitors.js:276:21)
      at NodePath._call (node_modules/babel-traverse/lib/path/context.js:76:18)
      at NodePath.call (node_modules/babel-traverse/lib/path/context.js:48:17)
      at NodePath.visit (node_modules/babel-traverse/lib/path/context.js:105:12)
      at TraversalContext.visitQueue (node_modules/babel-traverse/lib/context.js:150:16)
      at TraversalContext.visitMultiple (node_modules/babel-traverse/lib/context.js:103:17)
      at TraversalContext.visit (node_modules/babel-traverse/lib/context.js:190:19)
      at Function.traverse.node (node_modules/babel-traverse/lib/index.js:114:17)
      at NodePath.visit (node_modules/babel-traverse/lib/path/context.js:115:19)
      at TraversalContext.visitQueue (node_modules/babel-traverse/lib/context.js:150:16)
      at TraversalContext.visitSingle (node_modules/babel-traverse/lib/context.js:108:19)
      at TraversalContext.visit (node_modules/babel-traverse/lib/context.js:192:19)
      at Function.traverse.node (node_modules/babel-traverse/lib/index.js:114:17)
      at NodePath.visit (node_modules/babel-traverse/lib/path/context.js:115:19)
      at TraversalContext.visitQueue (node_modules/babel-traverse/lib/context.js:150:16)
      at TraversalContext.visitMultiple (node_modules/babel-traverse/lib/context.js:103:17)
      at TraversalContext.visit (node_modules/babel-traverse/lib/context.js:190:19)
      at Function.traverse.node (node_modules/babel-traverse/lib/index.js:114:17)
      at NodePath.visit (node_modules/babel-traverse/lib/path/context.js:115:19)
      at TraversalContext.visitQueue (node_modules/babel-traverse/lib/context.js:150:16)
      at TraversalContext.visitSingle (node_modules/babel-traverse/lib/context.js:108:19)
      at TraversalContext.visit (node_modules/babel-traverse/lib/context.js:192:19)
      at Function.traverse.node (node_modules/babel-traverse/lib/index.js:114:17)
      at NodePath.visit (node_modules/babel-traverse/lib/path/context.js:115:19)
      at TraversalContext.visitQueue (node_modules/babel-traverse/lib/context.js:150:16)
      at TraversalContext.visitMultiple (node_modules/babel-traverse/lib/context.js:103:17)
      at TraversalContext.visit (node_modules/babel-traverse/lib/context.js:190:19)
      at Function.traverse.node (node_modules/babel-traverse/lib/index.js:114:17)
      at NodePath.visit (node_modules/babel-traverse/lib/path/context.js:115:19)
      at TraversalContext.visitQueue (node_modules/babel-traverse/lib/context.js:150:16)
      at TraversalContext.visitQueue (node_modules/babel-traverse/lib/context.js:156:21)
      at TraversalContext.visitSingle (node_modules/babel-traverse/lib/context.js:108:19)
      at TraversalContext.visit (node_modules/babel-traverse/lib/context.js:192:19)
      at Function.traverse.node (node_modules/babel-traverse/lib/index.js:114:17)
      at NodePath.visit (node_modules/babel-traverse/lib/path/context.js:115:19)
      at TraversalContext.visitQueue (node_modules/babel-traverse/lib/context.js:150:16)
      at TraversalContext.visitMultiple (node_modules/babel-traverse/lib/context.js:103:17)
      at TraversalContext.visit (node_modules/babel-traverse/lib/context.js:190:19)
      at Function.traverse.node (node_modules/babel-traverse/lib/index.js:114:17)
      at NodePath.visit (node_modules/babel-traverse/lib/path/context.js:115:19)
      at TraversalContext.visitQueue (node_modules/babel-traverse/lib/context.js:150:16)
      at TraversalContext.visitSingle (node_modules/babel-traverse/lib/context.js:108:19)
      at TraversalContext.visit (node_modules/babel-traverse/lib/context.js:192:19)
      at Function.traverse.node (node_modules/babel-traverse/lib/index.js:114:17)
      at traverse (node_modules/babel-traverse/lib/index.js:79:12)
      at File.transform (node_modules/babel-core/lib/transformation/file/index.js:548:35)
      at node_modules/babel-core/lib/transformation/pipeline.js:50:19
      at File.wrap (node_modules/babel-core/lib/transformation/file/index.js:564:16)
      at Pipeline.transform (node_modules/babel-core/lib/transformation/pipeline.js:47:17)
      at testPlugin (test/testPlugin.js:4:18)
      at Context.<anonymous> (test/index.js:18:22)

An in-range update of eslint-plugin-import is breaking the build 🚨

Version 2.4.0 of eslint-plugin-import just got published.

Branch Build failing 🚨
Dependency eslint-plugin-import
Current Version 2.3.0
Type devDependency

This version is covered by your current version range and after updating it in your project the build failed.

As eslint-plugin-import is “only” a devDependency of this project it might not break production or downstream projects, but “only” your build or test tools – preventing new deploys or publishes.

I recommend you give this issue a high priority. I’m sure you can resolve this 💪

Status Details
  • continuous-integration/travis-ci/push The Travis CI build could not complete due to an error Details

Commits

The new version differs by 10 commits.

  • 44ca158 update utils changelog
  • a3728d7 bump eslint-module-utils to v2.1.0
  • 3e29169 bump v2.4.0
  • ea9c92c Merge pull request #737 from kevin940726/master
  • 8f9b403 fix typos, enforce type of array of strings in allow option
  • 95315e0 update CHANGELOG.md
  • 28e1623 eslint-module-utils: filePath in parserOptions (#840)
  • 2f690b4 update CI to build on Node 6+7 (#846)
  • 7d41745 write doc, add two more tests
  • dedfb11 add allow glob for rule no-unassigned-import, fix #671

See the full diff

Not sure how things should work exactly?

There is a collection of frequently asked questions and of course you may always ask my humans.


Your Greenkeeper Bot 🌴

Code splitting doesn't work with this plugin

When I add this plugin when code splitting with import('./ModuleA') doesn't work(((
But If I change import code to System.import all work perfectly.
You known how I can fix it?

An in-range update of babel-preset-airbnb is breaking the build 🚨

Version 2.3.0 of babel-preset-airbnb just got published.

Branch Build failing 🚨
Dependency babel-preset-airbnb
Current Version 2.2.3
Type devDependency

This version is covered by your current version range and after updating it in your project the build failed.

As babel-preset-airbnb is “only” a devDependency of this project it might not break production or downstream projects, but “only” your build or test tools – preventing new deploys or publishes.

I recommend you give this issue a high priority. I’m sure you can resolve this 💪

Status Details
  • continuous-integration/travis-ci/push The Travis CI build failed Details

Commits

The new version differs by 6 commits.

  • 9410812 Version 2.3.0
  • 98c9c1d Merge pull request #13 from airbnb/babel-preset-env
  • a3b73f6 Switches to use babel-preset-env
  • 13da4ee [Tests] npm v4.6+ doesn’t work on node < v1
  • 3065a5c [Deps] update babel-plugin-syntax-trailing-function-commas, babel-plugin-transform-es2015-template-literals, babel-plugin-transform-es3-member-expression-literals, babel-plugin-transform-es3-property-literals, babel-plugin-transform-exponentiation-operator, babel-plugin-transform-jscript, babel-plugin-transform-object-rest-spread, babel-preset-es2015, babel-preset-react
  • bd811d3 [Dev Deps] update eslint, eslint-config-airbnb-base, eslint-plugin-import

See the full diff

Not sure how things should work exactly?

There is a collection of frequently asked questions and of course you may always ask my humans.


Your Greenkeeper Bot 🌴

An in-range update of eslint is breaking the build 🚨

Version 4.11.0 of eslint was just published.

Branch Build failing 🚨
Dependency eslint
Current Version 4.10.0
Type devDependency

This version is covered by your current version range and after updating it in your project the build failed.

eslint is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.

Status Details
  • continuous-integration/travis-ci/push The Travis CI build could not complete due to an error Details

Release Notes v4.11.0
  • d4557a6 Docs: disallow use of the comma operator using no-restricted-syntax (#9585) (薛定谔的猫)
  • d602f9e Upgrade: espree v3.5.2 (#9611) (Kai Cataldo)
  • 4def876 Chore: avoid handling rules instances in config-validator (#9364) (Teddy Katz)
  • fe5ac7e Chore: fix incorrect comment in safe-emitter.js (#9605) (Teddy Katz)
  • 6672fae Docs: Fixed a typo on lines-between-class-members doc (#9603) (Moinul Hossain)
  • 980ecd3 Chore: Update copyright and license info (#9599) (薛定谔的猫)
  • cc2c7c9 Build: use Node 8 in appveyor (#9595) (薛定谔的猫)
  • 2542f04 Docs: Add missing options for lines-around-comment (#9589) (Clément Fiorio)
  • b6a7490 Build: ensure fuzzer tests get run with npm test (#9590) (Teddy Katz)
  • 1073bc5 Build: remove shelljs-nodecli (refs #9533) (#9588) (Teddy Katz)
  • 7e3bf6a Fix: edge-cases of semi-style (#9560) (Toru Nagashima)
  • e5a37ce Fix: object-curly-newline for flow code (#9458) (Tiddo Langerak)
  • 9064b9c Chore: add equalTokens in ast-utils. (#9500) (薛定谔的猫)
  • b7c5b19 Fix: Correct [object Object] output of error.data. (#9561) (Jonathan Pool)
  • 51c8cf0 Docs: Disambiguate definition of Update tag (#9584) (Jonathan Pool)
  • afc3c75 Docs: clarify what eslint-config-eslint is (#9582) (Teddy Katz)
  • aedae9d Docs: fix spelling in valid-typeof example (#9574) (Maksim Degtyarev)
  • 4c5aaf3 Docs: Fix typo in no-underscore-dangle rule (#9567) (Fabien Lucas)
  • 3623600 Chore: upgrade [email protected] (#9557) (薛定谔的猫)
  • 1b606cd Chore: Remove an indirect dependency on jsonify (#9444) (Rouven Weßling)
  • 4d7d7ab Update: Resolve npm installed formatters (#5900) (#9464) (Tom Erik Støwer)
  • accc490 Fix: Files with no failures get "passing" testcase (#9547) (Samuel Levy)
  • ab0f66d Docs: Add examples to better show rule coverage. (#9548) (Jonathan Pool)
  • 88d2303 Chore: Add object-property-newline tests to increase coverage. (#9553) (Jonathan Pool)
  • 7f37b1c Build: test Node 9 on Travis (#9556) (Teddy Katz)
  • acccfbd Docs: Minor rephrase in no-invalid-this. (#9542) (Francisc)
  • 8f9c0fe Docs: improve id-match usage advice (#9544) (Teddy Katz)
  • a9606a3 Fix: invalid tests with super (fixes #9539) (#9545) (Teddy Katz)
  • 8e1a095 Chore: enable a modified version of multiline-comment-style on codebase (#9452) (Teddy Katz)
  • cb60285 Chore: remove commented test for HTML formatter (#9532) (Teddy Katz)
  • 06b491e Docs: fix duplicate entries in changelog (#9530) (Teddy Katz)
  • 2224733 Chore: use eslint-plugin-rulesdir instead of --rulesdir for self-linting (#9164) (Teddy Katz)
  • 9cf4ebe Docs: add .md to link(for github users) (#9529) (薛定谔的猫)
Commits

The new version differs by 35 commits.

  • 1a9a6a5 4.11.0
  • ef4d268 Build: changelog update for 4.11.0
  • d4557a6 Docs: disallow use of the comma operator using no-restricted-syntax (#9585)
  • d602f9e Upgrade: espree v3.5.2 (#9611)
  • 4def876 Chore: avoid handling rules instances in config-validator (#9364)
  • fe5ac7e Chore: fix incorrect comment in safe-emitter.js (#9605)
  • 6672fae Docs: Fixed a typo on lines-between-class-members doc (#9603)
  • 980ecd3 Chore: Update copyright and license info (#9599)
  • cc2c7c9 Build: use Node 8 in appveyor (#9595)
  • 2542f04 Docs: Add missing options for lines-around-comment (#9589)
  • b6a7490 Build: ensure fuzzer tests get run with npm test (#9590)
  • 1073bc5 Build: remove shelljs-nodecli (refs #9533) (#9588)
  • 7e3bf6a Fix: edge-cases of semi-style (#9560)
  • e5a37ce Fix: object-curly-newline for flow code (#9458)
  • 9064b9c Chore: add equalTokens in ast-utils. (#9500)

There are 35 commits in total.

See the full diff

FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

Add ability to pre-require modules.

For me the main use case for this plugin is to allow bundling of my React app with Webpack while still supporting server side rendering. In a Node environment I actually want the code to be required at startup so the initial SSR isn't delayed while the bundle is evaluated.

If this is something you're interested in supporting I could make a PR, it should be as simple as using a template like Promise.resolve(require(SOURCE)) when some option is set.

Version 10 of node.js has been released

Version 10 of Node.js (code name Dubnium) has been released! 🎊

To see what happens to your code in Node.js 10, Greenkeeper has created a branch with the following changes:

  • Added the new Node.js version to your .travis.yml

If you’re interested in upgrading this repo to Node.js 10, you can open a PR with these changes. Please note that this issue is just intended as a friendly reminder and the PR as a possible starting point for getting your code running on Node.js 10.

More information on this issue

Greenkeeper has checked the engines key in any package.json file, the .nvmrc file, and the .travis.yml file, if present.

  • engines was only updated if it defined a single version, not a range.
  • .nvmrc was updated to Node.js 10
  • .travis.yml was only changed if there was a root-level node_js that didn’t already include Node.js 10, such as node or lts/*. In this case, the new version was appended to the list. We didn’t touch job or matrix configurations because these tend to be quite specific and complex, and it’s difficult to infer what the intentions were.

For many simpler .travis.yml configurations, this PR should suffice as-is, but depending on what you’re doing it may require additional work or may not be applicable at all. We’re also aware that you may have good reasons to not update to Node.js 10, which is why this was sent as an issue and not a pull request. Feel free to delete it without comment, I’m a humble robot and won’t feel rejected 🤖


FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

Repository out of sync with published version in npm?

Hi I was experimenting with some stuff in create-react-app 2.0 and noticed that this project's code seems to be out of sync with what has been published in npm.

Current package.json

"devDependencies": {
"airbnb-js-shims": "^2.0.0",
"babel-cli": "^6.26.0",
"babel-core": "^6.26.3",
"babel-eslint": "^8.2.5",
"babel-plugin-add-module-exports": "^0.2.1",
"babel-plugin-transform-es2015-template-literals": "^6.22.0",
"babel-plugin-transform-replace-object-assign": "^1.0.0",
"babel-preset-airbnb": "^2.5.1",
"babel-preset-es2015": "^6.24.1",
"babel-register": "^6.26.0",
"eslint": "^4.19.1",
"eslint-config-airbnb-base": "^13.0.0",
"eslint-plugin-import": "^2.13.0",
"in-publish": "^2.0.0",
"rimraf": "^2.6.2",
"safe-publish-latest": "^1.1.1",
"tape": "^4.9.1"
},

package.json of node_modules/babel-plugin-transform-dynamic-import after npm i in new project:

  "devDependencies": {
    "@babel/cli": "7.0.0-beta.34",
    "@babel/core": "7.0.0-beta.34",
    "@babel/plugin-transform-template-literals": "^7.0.0-beta.34",
    "@babel/preset-env": "^7.0.0-beta.34",
    "@babel/preset-es2015": "^7.0.0-beta.34",
    "@babel/register": "7.0.0-beta.34",
    "airbnb-js-shims": "^1.3.0",
    "babel-eslint": "^8.0.3",
    "chai": "^4.1.2",
    "eslint": "^4.11.0",
    "eslint-config-airbnb-base": "^12.1.0",
    "eslint-plugin-import": "^2.8.0",
    "in-publish": "^2.0.0",
    "mocha": "^4.0.1",
    "rimraf": "^2.6.2",
    "safe-publish-latest": "^1.1.1"
  }

An in-range update of eslint-plugin-import is breaking the build 🚨

The devDependency eslint-plugin-import was updated from 2.18.2 to 2.19.0.

🚨 View failing branch.

This version is covered by your current version range and after updating it in your project the build failed.

eslint-plugin-import is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.

Status Details
  • continuous-integration/travis-ci/push: The Travis CI build failed (Details).

Commits

The new version differs by 46 commits.

  • 9b76635 Bump to v2.19.0
  • 47a232e [resolvers/webpack] v0.12.0
  • 26ad476 [resolvers/webpack] [deps] update debug, enhanced-resolve, has, interpret, lodash, resolve, semver
  • 3f0e8f3 [resolvers/node] [Deps] update resolve
  • 7190c3e bump utils to v2.5.0
  • a60e5c6 [New] no-commonjs: add allowConditionalRequire option
  • 414c923 [New] enable passing cwd as an option to eslint-import-resolver-webpack
  • 8224e51 [New] order/no-extraneous-dependencies: Alphabetize imports within groups
  • f12ae59 [New] no-duplicates: add a considerQueryString option to handle false positives when using some webpack loaders.
  • 2d3d045 [fix] importType: Accept '@example' as internal
  • 0426f16 [New] order: add pathGroups option to add support to order by paths
  • 99b3fbf [Fix] no-extraneous-dependencies: Add support for export from
  • 21bf8c6 [Fix] no-cycle: should not warn for Flow imports
  • 0cd5e43 [Fix] no-unused-modules: fix crash due to export *
  • 05085bb [flow] no-unused-modules: add flow type support

There are 46 commits in total.

See the full diff

FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

Add CONTRIBUTING guide?

I'm trying to do a small PR but i can't seem to figure out what npm run check-changelog wants me to do 😢

Version 2.1.0 not on npm

This repo is at 2.1.0, while the npm package (babel-plugin-transform-dynamic-import
) is at 2.0.0. And it uses a beta version of Babel 7, while this repo is still at Babel 6.
Please update both the repo and the npm package please

Critical dependency: the request of a dependency is an expression

in vue-router

  {
    path: '/',
    name: 'home',
    component: () => import('@/views/home/index'),
    meta: {
      title: 'Home'
    }
  }

error: Critical dependency: the request of a dependency is an expression;
webpack-internal:///./node_modules/vue-router/dist/vue-router.esm.js:17 [vue-router] Failed to resolve async component default: Error: Cannot find module '@/views/home/index'

Rolling back and locking into 2.3.0 resolves the issue.

when module file use export default ...

my module file use
export default userSchema;
when use
import('path-to-module').then( module => { let m = module.default; ....})
so the m is the real module.
it's behavior is not equal to require()
can make import() use like require()?

An in-range update of babel-cli is breaking the build 🚨

Version 6.22.1 of babel-cli just got published.

Branch Build failing 🚨
Dependency babel-cli
Current Version 6.22.0
Type devDependency

This version is covered by your current version range and after updating it in your project the build failed.

As babel-cli is “only” a devDependency of this project it might not break production or downstream projects, but “only” your build or test tools – preventing new deploys or publishes.

I recommend you give this issue a high priority. I’m sure you can resolve this 💪


Status Details
  • continuous-integration/travis-ci/push The Travis CI build failed Details
Not sure how things should work exactly?

There is a collection of frequently asked questions and of course you may always ask my humans.


Your Greenkeeper Bot 🌴

Babylon parser issue

hi

same this one:
millermedeiros/esformatter#478

const middleware = import(`./${path.relative(__dirname, dir)}/${item}`) .then(middlewareImport => middlewareImport.default)
at Parser.pp$5.raise (/node_modules/babel-core/node_modules/babylon/lib/index.js:4452:13)

How to use it?

Readme do not hint anything how to use it or may be I am dumb.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.