Skip to content

Commit

Permalink
Fix module import and build on win system (#35)
Browse files Browse the repository at this point in the history
---------

Co-authored-by: Alex Khizhnyi <akhizhniy@spotware.com>
  • Loading branch information
veksa and Alex Khizhnyi authored Oct 10, 2024
1 parent fa83ce9 commit e5b2dfd
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
},
"type": "module",
"main": "./cjs/index.cjs",
"module": "./lib/index.js",
"exports": {
".": {
"import": "./lib/index.js",
Expand Down
6 changes: 3 additions & 3 deletions scripts/bundle.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ const { version } = createRequire(import.meta.url)('../package.json');

async function build() {
const genModules = {
[path.resolve('lib/version.js')]: `export const version = "${version}";`,
[path.resolve('lib/version.cjs')]: `module.exports = "${version}";`
'version.js': `export const version = "${version}";`,
'version.cjs': `module.exports = "${version}";`
};
const genModulesFilter = new RegExp('(' + Object.keys(genModules).join('|').replace(/\./g, '\\.') + ')$');
const genModulesFilter = new RegExp('lib[\\\\/](' + Object.keys(genModules).join('|').replace(/\./g, '\\.') + ')$');
const plugins = [{
name: 'replace',
setup({ onLoad }) {
Expand Down

0 comments on commit e5b2dfd

Please sign in to comment.