Last active
November 15, 2018 01:23
-
-
Save franjohn21/f9ed2e389f5070826343d38afed08a28 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| node_modules/ | |
| dist/ | |
| package-lock.json |
This file contains hidden or 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
| #!/usr/bin/env node | |
| const path = require('path'); | |
| const { transformFileSync } = require('@babel/core'); | |
| console.log('Running babel transform on dynamic import...'); | |
| try { | |
| transformFileSync(path.join(__dirname, 'index.js'), { | |
| plugins: [ | |
| '@babel/plugin-syntax-dynamic-import', | |
| 'babel-plugin-dynamic-import-node', | |
| 'babel-plugin-universal-import', | |
| ], | |
| }); | |
| } catch (e) { | |
| console.trace(e); | |
| } |
This file contains hidden or 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
| const foo = import('path'); |
This file contains hidden or 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
| { | |
| "name": "babel-universal-import-dynamic-import-issue", | |
| "version": "0.0.1", | |
| "bin": "./bin.js", | |
| "dependencies": { | |
| "@babel/core": "^7.0.0", | |
| "@babel/plugin-syntax-dynamic-import": "^7.0.0", | |
| "babel-plugin-dynamic-import-node": "^2.0.0", | |
| "babel-plugin-universal-import": "^3.0.0" | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment