Open ecgan opened 1 month ago
I looked into the code in https://www.npmjs.com/package/@automattic/jetpack-connection package and they seem to be the original source code with .jsx, .ts and .tsx files. There are no
build
orbuild-module
directories. I believe this is the cause of the problem.
Partially so. The default configuration for most JS build toolchains is to not transpile code from node_modules/
, assuming that most packages will provide built JS rather than source jsx or TypeScript. Adding a build step to js-packages/connection
to conform to this expectation is one possible fix. Reconfiguring your tooling to transpile this package is another.
Chances are we should have the package conform to the expectation, I just wanted to be clear about what the problem is.
Then there's the question of whether we should use tsc
to simply process the sources, assuming they'll be bundled by the consumer anyway, or webpack
to generate minified bundles. I'd probably lean towards the former.
As a comparison, if we look into the code in https://www.npmjs.com/package/@wordpress/components npm package, we can see there are
build
orbuild-module
directories, and they work out of the box with no issues in my plugin.
.gitattributes
, .gitignore
, composer.json
, and package.json
to do this within the monorepo. Unfortunately there's a bunch of other cleanup to the package happening in that PR too.I'm going to mark this as Triaged on our board, but let us know if you need help testing anything related to this.
Impacted plugin
None / Other
Quick summary
I am developing a custom WooCommerce plugin. The plugin uses https://www.npmjs.com/package/@wordpress/scripts and https://www.npmjs.com/package/@wordpress/dependency-extraction-webpack-plugin.
When I try to use https://www.npmjs.com/package/@automattic/jetpack-connection in the plugin to get Jetpack connection status (using
select( CONNECTION_STORE_ID ).getConnectionStatus()
as shown in the npm package readme.md), I'm seeing a bunch of errors in the terminal when I build the plugin. Here are some examples:I looked into the code in https://www.npmjs.com/package/@automattic/jetpack-connection package and they seem to be the original source code with .jsx, .ts and .tsx files. There are no
build
orbuild-module
directories. I believe this is the cause of the problem.As a comparison, if we look into the code in https://www.npmjs.com/package/@wordpress/components npm package, we can see there are
build
orbuild-module
directories, and they work out of the box with no issues in my plugin.Steps to reproduce
npm run build
ornpm run start
.A clear and concise description of what you expected to happen.
Build should be successful with no warnings and errors.
What actually happened
There are build warnings and errors as mentioned above.
Impact
One
Available workarounds?
There is no user impact
If the above answer is "Yes...", outline the workaround.
No response
Platform (Simple and/or Atomic)
No response
Logs or notes
No response