Skip to content

Failed to compile error when running on dev server locally after changing App.css in freshly created project #606

@j0214ack

Description

@j0214ack

After freshly run create-react-app demo
cd ./demo
npm start

Then modify App.css.

Console shows

Failed to compile.

Error in ./src/App.js
Module not found: Error: Cannot resolve module 'react-native-web' in /Users/jack/workspace/js/react/demo/src
 @ ./src/App.js 7:19-42

And my App.js mysteriously becomes

import React, {StyleSheet, Dimensions, PixelRatio} from "react-native";
const {width, height, scale} = Dimensions.get("window"),
    vw = width / 100,
    vh = height / 100,
    vmin = Math.min(vw, vh),
    vmax = Math.max(vw, vh);

export default StyleSheet.create({
    "App": {
        "textAlign": "center"
    },
    "App-logo": {
        "animation": "App-logo-spin infinite 20s linear",
        "height": 80
    },
    "App-header": {
        "backgroundColor": "#222",
        "height": 150,
        "paddingTop": 20,
        "paddingRight": 20,
        "paddingBottom": 20,
        "paddingLeft": 20,
        "color": "red"
    },
    "App-intro": {
        "fontSize": "large"
    }
});

Using create-react-app v0.3.0
(This persists after I updated react-scripts to v0.4.1)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions