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 {kettle} = require('./kettle.mjs') // fails with error | |
console.log(kettle) |
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
Show hidden characters
{ | |
"plugins": [ | |
"transform-es2015-modules-commonjs", "dynamic-import-node" | |
] | |
} |
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": "dual-cjs-mjs-package", | |
"version": "1.0.0", | |
"description": "A package that can be both imported as esm and as cjs", | |
"main": "entry", | |
"scripts": { | |
"build": "babel *.mjs **/*.mjs --out-dir ." | |
}, | |
"devDependencies": { | |
"babel-cli": "^6.26.0", |
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
import kettleModule from './kettle.js' // succeeds | |
console.log(kettleModule.kettle) |
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 {kettle} = require('./kettle.js') // fails with error | |
console.log(kettle) |
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
import {kettle} from './02-kettle.mjs' //fails with error | |
console.log(kettle) |
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
async function main() { | |
const {kettle} = await import('./kettle.mjs') // succeeds! | |
console.log(kettle) | |
} | |
main() |
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
import {handle, spout, tea} from './01-kettle.mjs' | |
console.log(handle) // ==> the handle | |
console.log(spout) // ==> the spout | |
console.log(tea) // ==> hot tea |
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
export const spout = 'the spout' | |
export const handle = 'the handle' | |
export const tea = 'hot tea' |
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 webdriver = require('selenium-webdriver') | |
const {By, until} = webdriver | |
const {Eyes} = require('eyes.selenium') | |
require('chromedriver') | |
describe.only('todo list', function() { | |
jest.setTimeout(30000) | |
let driver | |
beforeAll(async () => (driver = await new webdriver.Builder().forBrowser('chrome').build())) |