Search code examples
expovue-native

For creating a Vue Native App, do you need App.js?


This has been addressed twice here, but more of a question of how to get around it. I know how... you can just delete App.js. But my question is whether App.js will be needed down the road once it has been packaged for distribution, or at any other time. If so, I'd rather find another solution other than just deleting the file.

I'll provide the code in App.js. This is the basic file that is created from either vue-native init or expo init.

Looked at previous posts: Vue native is always executing App.js instead of .vue App.vue is not working in Vue-Native application

import React from 'react';
import { StyleSheet, Text, View } from 'react-native';

export default function App() {
  return (
    <View style={styles.container}>
      <Text>Open up App.js to start working on your app!</Text>
    </View>
  );
}

const styles = StyleSheet.create({
  container: {
    flex: 1,
    backgroundColor: '#fff',
    alignItems: 'center',
    justifyContent: 'center',
  },
});

Solution

  • If you're using webpack you can get around this by setting the entry point:

    module.exports = {
    ...
    entry: 'YourNewEntryPoint'
    ...
    }
    

    Without Webpack I'm not sure if there's a way to get around App.js being the entry point.