From 4d1453c9f6c5430680f937413949b8b97b71d217 Mon Sep 17 00:00:00 2001 From: Roman Dvornov Date: Thu, 10 Oct 2024 17:30:04 +0200 Subject: [PATCH] Refactor --- package.json | 1 - scripts/bundle.js | 6 +++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/package.json b/package.json index ab6c955..336d1a9 100644 --- a/package.json +++ b/package.json @@ -27,7 +27,6 @@ "unpkg": "dist/csstree-validator.esm.js", "jsdelivr": "dist/csstree-validator.esm.js", "browser": { - "path": false, "./cjs/version.cjs": "./dist/version.cjs", "./lib/version.js": "./dist/version.js" }, diff --git a/scripts/bundle.js b/scripts/bundle.js index 025b2d8..de632c9 100644 --- a/scripts/bundle.js +++ b/scripts/bundle.js @@ -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, '\\.').replace(/\\/g, '\\\\') + ')$'); + const genModulesFilter = new RegExp('lib[\\\\/](' + Object.keys(genModules).join('|').replace(/\./g, '\\.') + ')$'); const plugins = [{ name: 'replace', setup({ onLoad }) {