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

bug: extTransformsPlugin is outputting collections css files #3305

Open
3 tasks done
George-Payne opened this issue Mar 28, 2022 · 4 comments
Open
3 tasks done

bug: extTransformsPlugin is outputting collections css files #3305

George-Payne opened this issue Mar 28, 2022 · 4 comments
Labels
Resolution: Refine This PR is marked for Jira refinement. We're not working on it - we're talking it through.

Comments

@George-Payne
Copy link
Contributor

Prerequisites

Stencil Version

v2.14.2 😃

Current Behavior

When building a dist output with a collection dependency, the dependencies css files will be outputted as part of the collection output, however, they appear further up the file tree due to their relative file paths. These css files aren't needed needed for the collection.

image

Expected Behavior

The css files aren't outputted.

Steps to Reproduce

Clone https://github.com/George-Payne/extTransformsPlugin-bug-reproduction

yarn is being used for workspaces, npm wont work

  1. yarn
  2. yarn build

Observe:

collectionconsumer
├── dist
│   ├── cjs
│   ├── collection
│   ├── collectionconsumer
│   ├── esm
│   ├── index.cjs.js
│   ├── index.js
│   ├── loader
│   └── types
├── externalcollection    <------------- This folder should not be outputted
│   └── dist
│       └── collection
│           └── components
│               └── ext-component
│                   └── ext-component.css
├── node_modules
├── package.json
├── src
├── stencil.config.ts
└── tsconfig.json

Code Reproduction URL

https://github.com/George-Payne/extTransformsPlugin-bug-reproduction

Additional Information

No response

@ionitron-bot ionitron-bot bot added the triage label Mar 28, 2022
@rwaskiewicz rwaskiewicz added Resolution: Refine This PR is marked for Jira refinement. We're not working on it - we're talking it through. and removed triage labels Apr 4, 2022
@duncanhunter
Copy link

Any updates on this we are facing the same issue?

@DennisJamin
Copy link

Have you found any way to solve this locally? I'm facing the same issue.

@George-Payne
Copy link
Contributor Author

Have you found any way to solve this locally?

If you're using yarn 3+, you can apply the patch (#3306) directly to your the dependency:

https://yarnpkg.com/features/protocols/#patch

Run the patch command:

 yarn patch @stencil/core
➤ YN0000: Package @stencil/core@npm:2.17.4 got extracted with success!
➤ YN0000: You can now edit the following folder: /tmp/xfs-dde1e6ea/user
➤ YN0000: Once you are done run yarn patch-commit /tmp/xfs-dde1e6ea/user and Yarn will store a patchfile based on your changes.
➤ YN0000: Done in 0s 166ms

Open up the generated folder:

code /tmp/xfs-dde1e6ea/user

Modify compiler/stencil.js

-          const moduleFile = cmp && compilerCtx.moduleMap.get(cmp.sourceFilePath);
+          const moduleFile = cmp && !cmp.isCollectionDependency && compilerCtx.moduleMap.get(cmp.sourceFilePath);

Save the file, then apply the patch:

yarn patch-commit /tmp/xfs-dde1e6ea/user --save

I was originally doing this, but you need to do it every time you update stencil, and I decided it wasn't worth it, and to just add the folder to .gitignore and live with it.

@DennisJamin
Copy link

Thanks for your thorough writeup!

I'm using NPM and am considering the patch-package approach, but I indeed foresee the issues with updating Stencil. I'm surprised this isn't a more widespread issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Resolution: Refine This PR is marked for Jira refinement. We're not working on it - we're talking it through.
Projects
None yet
Development

No branches or pull requests

4 participants