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

fix(pubsub): fix ESM compatibility issue #14014

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@
"@babel/preset-react": "^7.0.0",
"@eslint/compat": "^1.2.0",
"@lerna/legacy-package-management": "^7.4.2",
"@rollup/plugin-commonjs": "^28.0.1",
"@rollup/plugin-typescript": "^11.1.6",
"@size-limit/dual-publish": "^8.1.0",
"@size-limit/file": "^8.1.0",
Expand Down
4 changes: 2 additions & 2 deletions packages/pubsub/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
"test:size": "size-limit",
"build-with-test": "npm run clean && npm run build",
"build:umd": "webpack && webpack --config ./webpack.config.dev.js",
"build:esm-cjs": "rollup --forceExit -c rollup.config.mjs && cp -R src/vendor dist/cjs/vendor && cp -R src/vendor dist/esm/vendor",
"build:watch": "mkdirp dist/esm/vendor && mkdirp dist/cjs/vendor && cp -R src/vendor dist/cjs/vendor && cp -R src/vendor dist/esm/vendor && rollup --forceExit -c rollup.config.mjs --watch",
"build:esm-cjs": "rollup --forceExit -c rollup.config.mjs && cp -R src/vendor dist/cjs/vendor",
"build:watch": "mkdirp dist/esm/vendor && mkdirp dist/cjs/vendor && cp -R src/vendor dist/cjs/vendor && rollup --forceExit -c rollup.config.mjs --watch",
"build": "npm run clean && npm run build:esm-cjs && npm run build:umd",
"clean": "npm run clean:size && rimraf dist lib lib-esm",
"clean:size": "rimraf dual-publish-tmp tmp*",
Expand Down
12 changes: 8 additions & 4 deletions packages/pubsub/rollup.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

import { fileURLToPath } from 'node:url';
import { defineConfig } from 'rollup';
import commonjs from '@rollup/plugin-commonjs';
import typescript from '@rollup/plugin-typescript';
import { getInputForGlob } from '../../rollup/utils.mjs';
import {
Expand All @@ -27,11 +28,14 @@ const config = defineConfig([
// ESM config
{
input: input,
external: [
fileURLToPath(new URL('src/vendor/paho-mqtt.js', import.meta.url)),
],
output: esmOutput,
plugins: [typescript(esmTSOptions)],
plugins: [
commonjs({
include: ['src/vendor/paho-mqtt.js'],
exclude: ['**/*.ts'],
}),
typescript(esmTSOptions),
],
},
]);

Expand Down
67 changes: 62 additions & 5 deletions yarn.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading