vite-plugin-react-native-web 1.1.2 → 1.2.0
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 +4 -3
- package/dist/es/index.js +4 -3
- package/package.json +1 -1
package/dist/cjs/index.js
CHANGED
|
@@ -4,7 +4,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
4
4
|
|
|
5
5
|
var vite = require('vite');
|
|
6
6
|
var flowRemoveTypes = require('flow-remove-types');
|
|
7
|
-
var fs = require('fs/promises');
|
|
7
|
+
var fs = require('node:fs/promises');
|
|
8
8
|
|
|
9
9
|
// import type { ViteReactNativeWebOptions } from '../types'
|
|
10
10
|
const development = process.env.NODE_ENV === 'development';
|
|
@@ -44,7 +44,7 @@ const reactNativeWeb = ( /*options: ViteReactNativeWebOptions = {}*/) => ({
|
|
|
44
44
|
name: 'react-native-web',
|
|
45
45
|
config: () => ({
|
|
46
46
|
define: {
|
|
47
|
-
global: '
|
|
47
|
+
global: 'self',
|
|
48
48
|
__DEV__: JSON.stringify(development),
|
|
49
49
|
'process.env.NODE_ENV': JSON.stringify(process.env.NODE_ENV),
|
|
50
50
|
},
|
|
@@ -60,12 +60,13 @@ const reactNativeWeb = ( /*options: ViteReactNativeWebOptions = {}*/) => ({
|
|
|
60
60
|
},
|
|
61
61
|
}),
|
|
62
62
|
async transform(code, id) {
|
|
63
|
+
id = id.split('?')[0];
|
|
63
64
|
if (!filter.test(id)) {
|
|
64
65
|
return;
|
|
65
66
|
}
|
|
66
67
|
let includeSourceMaps = true;
|
|
67
68
|
// Do not include source maps for files that are using 'use client' pragma since these break the esbuild mappings (https://github.com/vitejs/vite/issues/15012)
|
|
68
|
-
if (code.includes('
|
|
69
|
+
if (code.includes("'use client'") || code.includes('"use client"')) {
|
|
69
70
|
includeSourceMaps = false;
|
|
70
71
|
}
|
|
71
72
|
if (code.includes('@flow')) {
|
package/dist/es/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { transformWithEsbuild } from 'vite';
|
|
2
2
|
import flowRemoveTypes from 'flow-remove-types';
|
|
3
|
-
import fs from 'fs/promises';
|
|
3
|
+
import fs from 'node:fs/promises';
|
|
4
4
|
|
|
5
5
|
// import type { ViteReactNativeWebOptions } from '../types'
|
|
6
6
|
const development = process.env.NODE_ENV === 'development';
|
|
@@ -40,7 +40,7 @@ const reactNativeWeb = ( /*options: ViteReactNativeWebOptions = {}*/) => ({
|
|
|
40
40
|
name: 'react-native-web',
|
|
41
41
|
config: () => ({
|
|
42
42
|
define: {
|
|
43
|
-
global: '
|
|
43
|
+
global: 'self',
|
|
44
44
|
__DEV__: JSON.stringify(development),
|
|
45
45
|
'process.env.NODE_ENV': JSON.stringify(process.env.NODE_ENV),
|
|
46
46
|
},
|
|
@@ -56,12 +56,13 @@ const reactNativeWeb = ( /*options: ViteReactNativeWebOptions = {}*/) => ({
|
|
|
56
56
|
},
|
|
57
57
|
}),
|
|
58
58
|
async transform(code, id) {
|
|
59
|
+
id = id.split('?')[0];
|
|
59
60
|
if (!filter.test(id)) {
|
|
60
61
|
return;
|
|
61
62
|
}
|
|
62
63
|
let includeSourceMaps = true;
|
|
63
64
|
// Do not include source maps for files that are using 'use client' pragma since these break the esbuild mappings (https://github.com/vitejs/vite/issues/15012)
|
|
64
|
-
if (code.includes('
|
|
65
|
+
if (code.includes("'use client'") || code.includes('"use client"')) {
|
|
65
66
|
includeSourceMaps = false;
|
|
66
67
|
}
|
|
67
68
|
if (code.includes('@flow')) {
|