Skip to content

Instantly share code, notes, and snippets.

View brillout's full-sized avatar

Rom brillout

  • Europe, Bavaria, Munich
  • 23:23 (UTC +02:00)
  • X @brillout
View GitHub Profile
@brillout
brillout / migrate-esm-typescript-imports.js
Last active April 17, 2024 09:13
CJS->ESM migration script: append `.js` to all imports
/***************************
Script to append `.js` to the path of your imports.
Before:
```ts
// someTypeScriptFile.ts
import { something } from './some/module'
// Doesn't work in Chrome
window.onerror = () => {
console.log('window.onerror')
return true
}
window.addEventListener('error', ev => {
ev.preventDefault()
console.log("window.addEventListener('error')")
return true
// travis-framework.config.ts
// Code written by user
export default {
graphqlServer: {
url: 'graphql.shopify.dev'
}
}