diff --git a/packages/@lwc/wire-service/package.json b/packages/@lwc/wire-service/package.json index f9e3fbd80d..9d43e2ad8b 100644 --- a/packages/@lwc/wire-service/package.json +++ b/packages/@lwc/wire-service/package.json @@ -50,10 +50,15 @@ { "name": "@lwc/wire-service", "path": "dist/index.js" + }, + { + "name": "wire-service", + "path": "dist/index.js" } ], "expose": [ - "@lwc/wire-service" + "@lwc/wire-service", + "wire-service" ] } } diff --git a/scripts/tasks/check-and-rewrite-package-json.js b/scripts/tasks/check-and-rewrite-package-json.js index 4fbc316c46..c1b9c417c3 100644 --- a/scripts/tasks/check-and-rewrite-package-json.js +++ b/scripts/tasks/check-and-rewrite-package-json.js @@ -29,9 +29,13 @@ const IGNORED_PACKAGES = [ // This is the same list as in @lwc/rollup-plugin/src/index.ts const LWC_EXPOSED_MODULES = { - '@lwc/engine-dom': 'lwc', - '@lwc/synthetic-shadow': '@lwc/synthetic-shadow', - '@lwc/wire-service': '@lwc/wire-service', + '@lwc/engine-dom': ['lwc'], + '@lwc/synthetic-shadow': ['@lwc/synthetic-shadow'], + '@lwc/wire-service': [ + '@lwc/wire-service', + // TODO [#3517]: remove support for deprecated 'wire-service' import + 'wire-service', + ], }; const directories = globSync('./packages/@lwc/*').filter( @@ -92,19 +96,17 @@ for (const dir of directories) { peerDependencies, }; - const exposedModule = LWC_EXPOSED_MODULES[name]; - if (exposedModule) { + const exposedModules = LWC_EXPOSED_MODULES[name]; + if (exposedModules) { // Special case - consumers can do `import { LightningElement } from 'lwc'` and have it resolve to // `@lwc/engine-dom`. As for @lwc/synthetic-shadow and @lwc/wire-service, we have historically included these in // the "default modules" defined in @lwc/rollup-plugin. expectedJson.lwc = { - modules: [ - { - name: exposedModule, - path: 'dist/index.js', - }, - ], - expose: [exposedModule], + modules: exposedModules.map((exposedModule) => ({ + name: exposedModule, + path: 'dist/index.js', + })), + expose: exposedModules, }; }