vite-plugin-react-native-web 1.0.3 → 1.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cjs/index.js CHANGED
@@ -59,19 +59,25 @@ const reactNativeWeb = ( /*options: ViteReactNativeWebOptions = {}*/) => ({
59
59
  },
60
60
  },
61
61
  }),
62
- async transform(code, id) {
63
- if (!filter.test(id))
64
- return code;
65
- if (code.includes('@flow'))
62
+ transform(code, id) {
63
+ if (!filter.test(id)) {
64
+ return;
65
+ }
66
+ // Skip files that are using 'use client' pragma since these break esbuild mappings (https://github.com/vitejs/vite/issues/15012)
67
+ if (code.includes('\'use client\'') || code.includes('"use client"')) {
68
+ return;
69
+ }
70
+ if (code.includes('@flow')) {
66
71
  code = flowRemoveTypes(code).toString();
67
- return (await vite.transformWithEsbuild(code, id, {
72
+ }
73
+ return vite.transformWithEsbuild(code, id, {
68
74
  loader: loader['.js'],
69
75
  tsconfigRaw: {
70
76
  compilerOptions: {
71
77
  jsx: 'react-jsx',
72
78
  },
73
79
  },
74
- })).code;
80
+ });
75
81
  },
76
82
  });
77
83
 
package/dist/es/index.js CHANGED
@@ -55,19 +55,25 @@ const reactNativeWeb = ( /*options: ViteReactNativeWebOptions = {}*/) => ({
55
55
  },
56
56
  },
57
57
  }),
58
- async transform(code, id) {
59
- if (!filter.test(id))
60
- return code;
61
- if (code.includes('@flow'))
58
+ transform(code, id) {
59
+ if (!filter.test(id)) {
60
+ return;
61
+ }
62
+ // Skip files that are using 'use client' pragma since these break esbuild mappings (https://github.com/vitejs/vite/issues/15012)
63
+ if (code.includes('\'use client\'') || code.includes('"use client"')) {
64
+ return;
65
+ }
66
+ if (code.includes('@flow')) {
62
67
  code = flowRemoveTypes(code).toString();
63
- return (await transformWithEsbuild(code, id, {
68
+ }
69
+ return transformWithEsbuild(code, id, {
64
70
  loader: loader['.js'],
65
71
  tsconfigRaw: {
66
72
  compilerOptions: {
67
73
  jsx: 'react-jsx',
68
74
  },
69
75
  },
70
- })).code;
76
+ });
71
77
  },
72
78
  });
73
79
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vite-plugin-react-native-web",
3
- "version": "1.0.3",
3
+ "version": "1.1.1",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },