-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Add ESM support for common and common-client (rollup) (#604)
- Loading branch information
1 parent
3389983
commit 8cd0cdc
Showing
16 changed files
with
75 additions
and
50 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,3 +21,4 @@ yarn-error.log | |
.vscode | ||
dump.rdb | ||
.wrangler | ||
stats.html |
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
File renamed without changes.
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,43 +1,43 @@ | ||
import common from '@rollup/plugin-commonjs'; | ||
import json from '@rollup/plugin-json'; | ||
import resolve from '@rollup/plugin-node-resolve'; | ||
import terser from '@rollup/plugin-terser'; | ||
import typescript from '@rollup/plugin-typescript'; | ||
|
||
// This library is not minified as the final SDK package is responsible for minification. | ||
|
||
const getSharedConfig = (format, file) => ({ | ||
input: 'src/index.ts', | ||
// Intermediate modules don't bundle all dependencies. We leave that to leaf-node | ||
// SDK implementations. | ||
external: ['@launchdarkly/js-sdk-common'], | ||
output: [ | ||
{ | ||
format: format, | ||
sourcemap: true, | ||
file: file, | ||
}, | ||
], | ||
onwarn: (warning) => { | ||
if (warning.code !== 'CIRCULAR_DEPENDENCY') { | ||
console.error(`(!) ${warning.message}`); | ||
} | ||
}, | ||
}); | ||
|
||
export default [ | ||
{ | ||
...getSharedConfig('es', 'dist/index.es.js'), | ||
...getSharedConfig('es', 'dist/index.mjs'), | ||
plugins: [ | ||
typescript({ | ||
module: 'esnext', | ||
tsconfig: './tsconfig.json', | ||
outputToFilesystem: true, | ||
}), | ||
common({ | ||
transformMixedEsModules: true, | ||
esmExternals: true, | ||
}), | ||
resolve(), | ||
terser(), | ||
json(), | ||
], | ||
}, | ||
{ | ||
...getSharedConfig('cjs', 'dist/index.cjs.js'), | ||
plugins: [typescript(), common(), resolve(), terser(), json()], | ||
...getSharedConfig('cjs', 'dist/index.cjs'), | ||
plugins: [typescript({ tsconfig: './tsconfig.json' }), common(), resolve(), json()], | ||
}, | ||
]; |
This file contains 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
This file contains 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