File tree Expand file tree Collapse file tree 4 files changed +15
-13
lines changed
vite-plugin-react-native-lightning/src Expand file tree Collapse file tree 4 files changed +15
-13
lines changed Original file line number Diff line number Diff line change 1+ ---
2+ " @plextv/vite-plugin-react-native-lightning " : patch
3+ " @plextv/react-lightning-plugin-flexbox " : patch
4+ ---
5+
6+ chore(react-native): Fix RN not loading properly
Original file line number Diff line number Diff line change 11import { defineConfig } from 'vite' ;
22
3+ const esmExt = 'js' ;
4+ const cjsExt = 'cjs' ;
35const createEntryCode = ( fileName ) => `'use strict';
46if (process.env.NODE_ENV === 'production') {
5- module.exports = require('./${ fileName } .production.min.js ');
7+ module.exports = require('./${ fileName } .production.${ cjsExt } ');
68} else {
7- module.exports = require('./${ fileName } .development.js ');
9+ module.exports = require('./${ fileName } .development.${ cjsExt } ');
810}` ;
911
1012/**
@@ -29,7 +31,7 @@ const generateEntryFile = {
2931
3032 this . emitFile ( {
3133 type : 'asset' ,
32- fileName : `cjs/${ name } .js ` ,
34+ fileName : `cjs/${ name } .${ cjsExt } ` ,
3335 source : createEntryCode ( name ) ,
3436 } ) ;
3537 } ,
@@ -41,7 +43,7 @@ export default defineConfig(({ mode }) => ({
4143 entry : 'src/index.ts' ,
4244 name : 'index' ,
4345 fileName : ( format , entryName ) =>
44- `${ format } /${ entryName } .${ mode } .${ format === 'es' ? 'mjs' : 'js' } ` ,
46+ `${ format } /${ entryName } .${ mode } .${ format === 'es' ? esmExt : cjsExt } ` ,
4547 formats : [ 'es' , 'cjs' ] ,
4648 } ,
4749 minify : mode === 'production' ,
Original file line number Diff line number Diff line change 1212 "url" : " https://github.com/plexinc/react-lightning/issues/new"
1313 },
1414 "type" : " module" ,
15- "main" : " ./dist/cjs/index.js " ,
15+ "main" : " ./dist/cjs/index.cjs " ,
1616 "module" : " ./dist/es/index.production.js" ,
1717 "types" : " ./dist/types/index.d.ts" ,
1818 "exports" : {
2626 "exports" : {
2727 "." : {
2828 "import" : " ./dist/es/index.production.js" ,
29- "require" : " ./dist/cjs/index.js " ,
29+ "require" : " ./dist/cjs/index.cjs " ,
3030 "types" : " ./dist/types/index.d.ts"
3131 },
3232 "./package.json" : " ./package.json" ,
Original file line number Diff line number Diff line change 1- import { createRequire } from 'node:module' ;
21import react from '@vitejs/plugin-react' ;
32import type { PluginOption } from 'vite' ;
43
@@ -24,11 +23,6 @@ type Options = {
2423} ;
2524
2625const vitePlugin = ( options ?: Options ) : PluginOption => {
27- const require = createRequire ( options ?. cwd ?? process . cwd ( ) ) ;
28- const reactNativeLightningPath = require . resolve (
29- '@plextv/react-native-lightning' ,
30- ) ;
31-
3226 return [
3327 react ( options ?. reactOptions ) ,
3428 {
@@ -43,7 +37,7 @@ const vitePlugin = (options?: Options): PluginOption => {
4337 resolve : {
4438 extensions,
4539 alias : {
46- 'react-native' : reactNativeLightningPath ,
40+ 'react-native' : '@plextv/react-native-lightning' ,
4741 } ,
4842 } ,
4943 } ) ,
You can’t perform that action at this time.
0 commit comments