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

Updates for stencil storybook babel #729

Merged

Conversation

marckassay
Copy link
Contributor

In my opening comment in PR #711, I mentioned a caveat that this PR resolves.

Although the Stencil issue/feature I mentioned in a source code comment for that PR is still open, I recently discovered that Babel was not configured to prevent tree shaking which was removing Stencil's h module. Setting onlyRemoveTypeImports to true in Babel config file prevents h module from being removed.

In addition, Babel 7 config file (.babelrc.json) is now deployed for new Stencil Storybook projects. This is for Babel project level adjustments if needed. In order for this to work, babel-loader for Webpack is required to have the following option property: rootMode: 'upward'. This property, when config files are being used, can only be set during runtime. This PR programmatically sets that when the root '.storybook/main.ts' file is being processed.

Make edits and please ask for any clarification if needed.

Prior to executing the script below if you choose, run verdaccio locally and: clone, build and publish (/dist/packages/stencil package) with semver version of choice. Below I used 14.0.3-local.1. This script is a smoke test that I used and should launch Storybook with a single story generated.

npx create-nx-workspace@latest --name nx-workspace --cli nx --preset angular --appName web --style css --packageManager npm --nxCloud false
cd nx-workspace
npm add @nxext/stencil@14.0.3-local.1 --save
git add .
git commit -m "post: npm add @nxext/stencil"
npx nx generate @nxext/stencil:library nx-project --buildable --style css
git add .
git commit -m "post: nx generate @nxext/stencil:library nx-project"
npx nx generate @nxext/stencil:storybook-configuration nx-project --configureCypress true
git add .
git commit -m "post: nx generate @nxext/stencil:storybook-configuration"
npx nx generate @nxext/stencil:component --project nx-project --name test-component
git add .
git commit -m "post: nx generate @nxext/stencil:component"
npx nx generate @nxext/stencil:add-outputtarget --outputType angular --projectName nx-project
git add .
git commit -m "post: nx generate @nxext/stencil:add-outputtarget"
npx nx run nx-project:build
git add .
git commit -m "post: nx run nx-project-build"
npx nx run nx-project:test
npx nx run nx-project:storybook

- Remove stencil import 'h' module hack in stories file
- Update babel 7+ config for workspace
- Update folder for storybook workspace
@nx-cloud
Copy link

nx-cloud bot commented Jun 29, 2022

☁️ Nx Cloud Report

CI is running/has finished running commands for commit 802fb9b. As they complete they will appear below. Click to see the status, the terminal output, and the build insights.

📂 See all runs for this branch


✅ Successfully ran 6 targets

Sent with 💌 from NxCloud.

@DominikPieper DominikPieper merged commit 4733e20 into nxext:main Jul 5, 2022
@marckassay marckassay deleted the updates-for-stencil-storybook-babel-hack branch July 18, 2022 12:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants