Skip to content

Commit b703d05

Browse files
committed
Small fixes: remove array destruction
1 parent a7c70a6 commit b703d05

File tree

4 files changed

+6
-11
lines changed

4 files changed

+6
-11
lines changed

.npmignore

+1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
src/
22
test/
3+
.idea

README.md

+3-9
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ I am using it for server-side rendering.
88

99
**babel-plugin-dynamic-import-node-sync**
1010
```
11-
import(SOURCE) => require(SOURCE)
11+
import(SOURCE) => () => { const r=require(SOURCE);r.then(cb=>cb(r));return r; }()
1212
```
1313

1414
**babel-plugin-dynamic-import-node**
@@ -19,7 +19,7 @@ import(SOURCE) => Promise.resolve().then(() => require(SOURCE))
1919
## Installation
2020

2121
```sh
22-
$ npm install babel-plugin-dynamic-import-node-sync --save-dev
22+
$ npm install @ridestore/babel-plugin-dynamic-import-node-sync --save-dev
2323
```
2424

2525
## Usage
@@ -30,12 +30,6 @@ $ npm install babel-plugin-dynamic-import-node-sync --save-dev
3030

3131
```json
3232
{
33-
"plugins": ["dynamic-import-node-sync"]
33+
"plugins": ["@ridestore/babel-plugin-dynamic-import-node-sync"]
3434
}
3535
```
36-
37-
### Via CLI
38-
39-
```sh
40-
$ babel --plugins dynamic-import-node-sync script.js
41-
```

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"name": "babel-plugin-dynamic-import-node-sync",
2+
"name": "@ridestore/babel-plugin-dynamic-import-node-sync",
33
"version": "1.0.1",
44
"description": "Babel 6 plugin to transpile import() to a require(), for node",
55
"main": "lib/index.js",

src/index.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ export default () => ({
1414
CallExpression(path) {
1515
if (path.node.callee.type === TYPE_IMPORT) {
1616
const importArgument = path.node.arguments[0];
17-
const [, syncComment] = importArgument;
17+
const syncComment = importArgument[1];
1818

1919
if (!syncComment || !syncComment.value || !(syncComment.value.trim().toLowerCase() === 'sync')) {
2020
return;

0 commit comments

Comments
 (0)