Closed panzacoder closed 9 months ago
đź‘‹ You very much may want to solve this in a different way. After finding this I was able to equally solve the problem by updating my babelPlugins
config like this:
{
name: getAbsolutePath('@storybook/addon-react-native-web'),
options: {
projectRoot,
modulesToTranspile: [
'app', // this is my local monorepo package
'react-native',
'react-native-web',
'solito',
'moti',
'react-native-reanimated',
'react-native-css-interop',
'nativewind',
'react-native-gesture-handler',
],
babelPlugins: [
'react-native-reanimated/plugin',
[
'@babel/plugin-transform-react-jsx',
{
runtime: 'automatic',
importSource: 'nativewind',
},
],
],
},
},
The key line being the change to the @babel/plugin-transform-react-jsx
. I tried MANY ways of configuring this for babel otherwise, but this is the only method that would work in order to make the transformation keep the NativeWind classNames intact.
@panzacoder I've updated this pr with some more changes to now allow babel presets and also to pass options to the react native preset
New and removed dependencies detected. Learn more about Socket for GitHub ↗︎
đźš® Removed packages: npm/@types/d3-array@3.2.1, npm/@types/d3-color@3.1.3, npm/@types/d3-ease@3.0.2, npm/@types/d3-interpolate@3.0.4, npm/@types/d3-path@3.0.2, npm/@types/d3-scale@4.0.8, npm/@types/d3-shape@3.1.6, npm/@types/d3-time@3.0.3, npm/@types/d3-timer@3.0.2, npm/d3-array@3.2.4, npm/d3-color@3.1.0, npm/d3-ease@3.0.1, npm/d3-format@3.1.0, npm/d3-interpolate@3.0.1, npm/d3-path@3.1.0, npm/d3-scale@4.0.2, npm/d3-shape@3.2.0, npm/d3-time-format@4.1.0, npm/d3-time@3.1.0, npm/d3-timer@3.0.1, npm/d3-voronoi@1.1.4, npm/delaunator@4.0.1, npm/delaunay-find@0.0.6, npm/internmap@2.0.3, npm/json-stringify-safe@5.0.1, npm/react-fast-compare@3.2.2, npm/victory-area@36.9.1, npm/victory-axis@36.9.1, npm/victory-bar@36.9.1, npm/victory-box-plot@36.9.1, npm/victory-brush-container@36.9.1, npm/victory-brush-line@36.9.1, npm/victory-candlestick@36.9.1, npm/victory-canvas@36.9.1, npm/victory-chart@36.9.1, npm/victory-core@36.9.1, npm/victory-create-container@36.9.1, npm/victory-cursor-container@36.9.1, npm/victory-errorbar@36.9.1, npm/victory-group@36.9.1, npm/victory-histogram@36.9.1, npm/victory-legend@36.9.1, npm/victory-line@36.9.1, npm/victory-native@40.0.3, npm/victory-pie@36.9.1, npm/victory-polar-axis@36.9.1, npm/victory-scatter@36.9.1, npm/victory-selection-container@36.9.1, npm/victory-shared-events@36.9.1, npm/victory-stack@36.9.1, npm/victory-tooltip@36.9.1, npm/victory-vendor@36.9.1, npm/victory-voronoi-container@36.9.1, npm/victory-voronoi@36.9.1, npm/victory-zoom-container@36.9.1, npm/victory@36.9.1
👍 Dependency issues cleared. Learn more about Socket for GitHub ↗︎
This PR previously contained dependency changes with security issues that have been resolved, removed, or ignored.
Ignoring: npm/@alloc/quick-lru@5.2.0
, npm/any-promise@1.3.0
, npm/autoprefixer@10.4.17
, npm/babel-plugin-tester@11.0.4
, npm/camelcase-css@2.0.1
, npm/core-js@3.35.1
, npm/cosmiconfig@9.0.0
, npm/didyoumean@1.2.2
, npm/dlv@1.1.3
, npm/fraction.js@4.3.7
, npm/jiti@1.21.0
, npm/lightningcss-darwin-arm64@1.22.0
, npm/lightningcss-darwin-x64@1.22.0
, npm/lightningcss-freebsd-x64@1.22.0
, npm/lightningcss-linux-arm-gnueabihf@1.22.0
, npm/lightningcss-linux-arm64-gnu@1.22.0
, npm/lightningcss-linux-arm64-musl@1.22.0
, npm/lightningcss-linux-x64-gnu@1.22.0
, npm/lightningcss-linux-x64-musl@1.22.0
, npm/lightningcss-win32-x64-msvc@1.22.0
, npm/lightningcss@1.22.0
, npm/lilconfig@2.1.0
, npm/lilconfig@3.0.0
, npm/nativewind@4.0.23
, npm/normalize-range@0.1.2
, npm/object-hash@3.0.0
, npm/pify@2.3.0
, npm/postcss-import@15.1.0
, npm/postcss-import@16.0.0
, npm/postcss-js@4.0.1
, npm/postcss-load-config@4.0.2
, npm/postcss-loader@8.1.0
, npm/postcss-nested@6.0.1
, npm/react-native-css-interop@0.0.22
, npm/read-cache@1.0.0
, npm/strip-indent@3.0.0
, npm/tailwindcss@3.4.1
, npm/thenify-all@1.6.0
, npm/thenify@3.3.1
Take a moment to review the security alert above. Review the linked package source code to understand the potential risk. Ensure the package is not malicious before proceeding. If you're unsure how to proceed, reach out to your security team or ask the Socket team for help at support [AT] socket [DOT] dev.
If you happen to install a dependency that Socket reports as Known Malware you should immediately remove it and select a different dependency. For other alert types, you may may wish to investigate alternative packages or consider if there are other ways to mitigate the specific risk posed by the dependency.
To ignore an alert, reply with a comment starting with @SocketSecurity ignore
followed by a space separated list of ecosystem/package-name@version
specifiers. e.g. @SocketSecurity ignore npm/foo@1.0.0
or ignore all packages with @SocketSecurity ignore-all
@panzacoder I've updated this pr with some more changes to now allow babel presets and also to pass options to the react native preset
@dannyhw Just looked through the changes, looks good to me, and looks like you added nativewind support to the .storybook/main.js
. Is that for your example or are you planning to ship that support zero-config?
@panzacoder thats just adding it to the example so that its tested
@SocketSecurity ignore-all
Added an option to pass in custom options for
babel/preset-react
, which is required in order to set theimportSource
for Nativewind v4.I believe this is the root of these issues: