-
Notifications
You must be signed in to change notification settings - Fork 4
[No Ticket] Fully convert to mjs & adjust babel and test options #348
Conversation
sourcemap: true | ||
dir: OUTPUT_DIR, | ||
entryFileNames: '[name].cjs', | ||
chunkFileNames: '[name]-[hash].cjs', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why chunks? Are you splitting it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is internally used by rollup. By default it will generate them with plain .js extension, but if we switch to module, we need to give them explicit .cjs extension (as they are commonjs).
Example:
❯ la dist
Permissions Size User Group Date Modified Git Name
.rw-r--r-- 585 mschuwalow staff 6 Mar 17:09 -I index.cjs
.rw-r--r-- 276 mschuwalow staff 6 Mar 17:09 -I index.cjs.map
.rw-r--r-- 307 mschuwalow staff 6 Mar 17:09 -I index.cjs.mjs
.rw-r--r-- 2.9k mschuwalow staff 6 Mar 17:09 -I index.d.ts
.rw-r--r-- 66k mschuwalow staff 6 Mar 17:09 -I initializer-me88Mdta.cjs
.rw-r--r-- 64k mschuwalow staff 6 Mar 17:09 -I initializer-me88Mdta.cjs.map
.rw-r--r-- 584 mschuwalow staff 6 Mar 17:09 -I internal.cjs
.rw-r--r-- 107 mschuwalow staff 6 Mar 17:09 -I internal.cjs.map
.rw-r--r-- 470 mschuwalow staff 6 Mar 17:09 -I internal.cjs.mjs
.rw-r--r-- 1.1k mschuwalow staff 6 Mar 17:09 -I internal.d.ts
.rw-r--r-- 6.6k mschuwalow staff 6 Mar 17:09 -I standard-live-connect.d-CGhFVSFd.d.ts
initializer-* are the ones affected by this setting
@@ -1,5 +1,5 @@ | |||
import { EventBus, isObject, expiresInDays } from 'live-connect-common' | |||
import { WrappedStorageHandler } from './handlers/storage-handler' | |||
import { WrappedStorageHandler } from './handlers/storage-handler.js' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Importing local ts
files as js
files? Wut?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Normal node resolution mode. Esm modules want to have an explicit extension.
This can be disabled with --experimental-specifier-resolution=node, but I decided to just stick with the defaults
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is wired and contr-intuitive. Can you at least make it consume ts
extension? I'm not sure the navigation will work in IntelliJ as it is right now...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See here for more details for example https://stackoverflow.com/questions/62619058/appending-js-extension-on-relative-import-statements-during-typescript-compilat.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you try navigation out? It should work without any issues (as this is pretty much the 'default' setup now)
For this to work we would need to emit sourcemaps from liveconnectbuilder, which we are not. Here it's really only relevant when getting used as a library. |
@@ -3,10 +3,10 @@ | |||
import jsdom from 'global-jsdom' | |||
import sinon from 'sinon' | |||
import { expect, use } from 'chai' | |||
import { MinimalLiveConnect, LiveConnect } from '../../src' | |||
import { MinimalLiveConnect, LiveConnect } from '../../src/index.js' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Node resolution can't find index
automatically?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Author Todo List:
Ready For Review
status