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

Docs: Raw support for mjs, jsx, and tsx files #21671

Merged
merged 7 commits into from
Nov 28, 2023

Conversation

42shadow42
Copy link
Contributor

@42shadow42 42shadow42 commented Mar 18, 2023

What I did

Enabled support for loading truly raw mjs,jsx, and tsx files by disabling the babel-loader when the raw query is set.

How to test

  1. Run a sandbox for template, e.g. yarn task --task sandbox --template react-webpack/18-ts
  2. Open Storybook in your browser
  3. Comment the webpackFinal overrides in .storybook/main.ts
  4. Access ?path=/docs/addons-docs-stories-mdx-raw-source--docs
  5. Verify you see:
import React, { Fragment } from 'react';

export const MY_VALUE_I_WANT_TO_SHOW_IN_STORY = 'Hello World!';

export const RawSource = () => {
  return <Fragment>{MY_VALUE_I_WANT_TO_SHOW_IN_STORY}</Fragment>;
};

Instead of:

import React, { Fragment } from "react";
export const MY_VALUE_I_WANT_TO_SHOW_IN_STORY = "Hello World!";
export const RawSource = () => {
  return /* @__PURE__ */ React.createElement(Fragment, null, MY_VALUE_I_WANT_TO_SHOW_IN_STORY);
};

Checklist

  • Make sure your changes are tested (stories and/or unit, integration, or end-to-end tests)
  • Make sure to add/update documentation regarding your changes
  • If you are deprecating/removing a feature, make sure to update
    MIGRATION.MD

Maintainers

  • If this PR should be tested against many or all sandboxes,
    make sure to add the ci:merged or ci:daily GH label to it.
  • Make sure this PR contains one of the labels below.

["cleanup", "BREAKING CHANGE", "feature request", "bug", "documentation", "maintenance", "dependencies", "other"]

@42shadow42
Copy link
Contributor Author

I hope it's okay, I'm marking this as ready for review despite a lack of test automation because I'm not sure how to get started testing this feature automatically, as is it can't even be tested manually without making manual modifications to the testing scaffolds. After taking a glance if you could point me in a good direction I'll continue on those parts of the PR.

@42shadow42 42shadow42 marked this pull request as ready for review March 18, 2023 21:47
@42shadow42 42shadow42 changed the title Raw support for mjs,jsx, and tsx files Raw support for mjs, jsx, and tsx files Mar 18, 2023
@yannbf
Copy link
Member

yannbf commented Mar 20, 2023

Hey @42shadow42 thank you so much for your contribution! Let's involve @ndelangen to help you get started with testing, and @jonniebigodes to chime in regarding possible documentation changes.

thanks!

@yannbf
Copy link
Member

yannbf commented Apr 21, 2023

Hey @ndelangen do you think this is good to (rebase then) merge?

@ndelangen ndelangen assigned shilman and JReinhold and unassigned ndelangen Nov 24, 2023
@ndelangen ndelangen changed the title Raw support for mjs, jsx, and tsx files Docs: Raw support for mjs, jsx, and tsx files Nov 24, 2023
@ndelangen ndelangen self-assigned this Nov 28, 2023
…book into pr/42shadow42/21671

# Conflicts:
#	code/addons/docs/template/stories/stories-mdx/RawSource.jsx
#	code/addons/docs/template/stories/stories-mdx/raw-source.non-stories.js
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.

6 participants