Skip to content

Instantly share code, notes, and snippets.

@franjohn21
Last active November 15, 2018 01:23
Show Gist options
  • Save franjohn21/f9ed2e389f5070826343d38afed08a28 to your computer and use it in GitHub Desktop.
Save franjohn21/f9ed2e389f5070826343d38afed08a28 to your computer and use it in GitHub Desktop.
node_modules/
dist/
package-lock.json
#!/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);
}
const foo = import('path');
{
"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