Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add CJS build for messaging/sw #5884

Merged
merged 2 commits into from Jan 13, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 6 additions & 1 deletion packages/messaging/package.json
Expand Up @@ -7,6 +7,7 @@
"browser": "dist/esm/index.esm2017.js",
"module": "dist/esm/index.esm2017.js",
"sw": "dist/index.sw.esm2017.js",
"sw-main": "dist/index.sw.cjs",
"esm5": "dist/esm/index.esm.js",
"exports": {
".": {
Expand All @@ -15,7 +16,11 @@
"esm5": "./dist/esm/index.esm.js",
"default": "./dist/index.cjs.js"
},
"./sw": "./dist/index.sw.esm2017.js",
"./sw": {
"require": "./dist/index.sw.cjs",
"import": "./dist/index.sw.esm2017.js",
"default": "./dist/index.sw.esm2017.js"
},
"./package.json": "./package.json"
},
"typings": "dist/src/index.d.ts",
Expand Down
10 changes: 10 additions & 0 deletions packages/messaging/rollup.config.js
Expand Up @@ -89,6 +89,16 @@ const cjsBuilds = [
replace(generateBuildTargetReplaceConfig('cjs', 5))
],
external: id => deps.some(dep => id === dep || id.startsWith(`${dep}/`))
},
// sw builds
{
input: 'src/index.sw.ts',
output: { file: pkg['sw-main'], format: 'cjs', sourcemap: true },
plugins: [
...es5BuildPlugins,
replace(generateBuildTargetReplaceConfig('cjs', 5))
],
external: id => deps.some(dep => id === dep || id.startsWith(`${dep}/`))
}
];

Expand Down
1 change: 1 addition & 0 deletions packages/messaging/sw/package.json
Expand Up @@ -2,6 +2,7 @@
"name": "@firebase/messaging-sw",
"description": "",
"author": "Firebase <firebase-support@google.com> (https://firebase.google.com/)",
"main": "../dist/index.sw.cjs",
"module": "../dist/index.sw.esm2017.js",
"typings": "../dist/src/index.sw.d.ts"
}