File tree Expand file tree Collapse file tree 3 files changed +19
-6
lines changed
Expand file tree Collapse file tree 3 files changed +19
-6
lines changed Original file line number Diff line number Diff line change 1+ src
Original file line number Diff line number Diff line change 33Node 6 supports almost whole ES 6 specification but there is not support for ES6 imports :/
44
55This plugin transforms your ES6 imports to commonjs counterparts.
6- No sourcemapping is needed.
6+ ** NO BABEL, No sourcemapping is needed** .
77
88** The output is in ES6** .
99
1010As a result, you can use it with Node 6 for server implementations.
1111
12+ EXAMPLE:
13+
14+ ``` js
15+ import Foo , { Foo1 } from ' Bar' ;
16+
17+ to
18+
19+ const Foo = require (' Bar' ).default ;
20+ const { Foo1 } = require (' Bar' );
21+ ```
22+
1223# How to use
1324
1425Simply import the registration script as a first line in your server:
Original file line number Diff line number Diff line change 44 "description" : " Transforms import statements to commonjs" ,
55 "main" : " dist/index.js" ,
66 "scripts" : {
7- "test" : " echo \" Error: no test specified\" && exit 1"
7+ "test" : " echo \" Tests are setup for Wallaby.JS\" && exit 1" ,
8+ "build" : " tsc -p ./src"
9+ },
10+ "repository" : {
11+ "url" : " https://github.com/tomitrescak/transform-to-commonjs"
812 },
913 "keywords" : [
1014 " NodeJs" ,
1317 " Javascript"
1418 ],
1519 "author" : " Tomi Trescak" ,
16- "license" : " MIT" ,
17- "devDependencies" : {
18- "assert" : " ^1.4.1"
19- }
20+ "license" : " MIT"
2021}
You can’t perform that action at this time.
0 commit comments