Module parse failed: Unexpected token
tk42 opened this issue · comments
Hi guys!
I’m trying to convert my app design from pxcode to the code of ReactNative.
- [Report] Missing package.json in this repo.
After copied the react native code in pxcode, I got the error as follows;
Module not found: Can't resolve 'react-posize'
4 | import React from 'react';
5 | import { View, StyleSheet, Text, Image, ImageBackground } from 'react-native';
> 6 | import { Px } from 'react-posize';
| ^
7 |
8 | export default function Main(props: any) {
9 | return (
I found the generated code needed this repository pxcode/posize. So I installed this repository because react-posize is missing in the package manager.
yarn add https://github.com/px2code/posize
But I still got the same error. When I digged this repository, I found package.json is missing in this repository.
I created package.json as follows then the error was disappeared ;)
{
"name": "react-posize",
"version": "1.0.0",
"description": "Posize React Component",
"main": "./src/index.js",
"module": "./src/index.js",
"type": "module",
"scripts": {},
"keywords": [
"react",
"posize"
],
"author": "James from pxCode",
"license": "MIT Licence",
"dependencies": {
"aphrodite": "^2.4.0",
"react-bootstrap": "~2.1.1"
}
}
- Missing webpack.
After that, I got another error as follows;
./node_modules/react-posize/src/v1.00.js 183:4
Module parse failed: Unexpected token (183:4)
You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders
| maxDisplay, xxxlDisplay, xxlDisplay, xlDisplay, lgDisplay, mdDisplay ,smDisplay, xsDisplay, trackStyle, areaStyle);
| return (
> <div key={'track'}
| className={
| [
As far as I know, v1.00.js seems to be broken. Does anyone know how to fix this error?
Mistook to open the issue to px2code/react-posize repo