remix-run / starter-express Goto Github PK
View Code? Open in Web Editor NEWStarter project for using Remix with Express
Home Page: https://remix.run
Starter project for using Remix with Express
Home Page: https://remix.run
After cloning, installing, and running this example repo I see the following in the console:
Warning: Did not expect server HTML to contain a <script> in <html>.
head
html
App@http://localhost:3000/build/root.js:11:26
RemixErrorBoundary
RemixRoute@http://localhost:3000/build/_shared/__remix-run/react-fd118932.js:528:14
Routes@http://localhost:3000/build/_shared/__remix-run/react-fd118932.js:690:27
Router@http://localhost:3000/build/_shared/react-router-44425546.js:8:283
RemixErrorBoundary
RemixEntry@http://localhost:3000/build/_shared/__remix-run/react-fd118932.js:341:24
RemixBrowser@http://localhost:3000/build/_shared/__remix-run/react-fd118932.js:709:32
This does not occur if if I run npm run build
and npm run start
so it appears to be something to do with the development server.
Most folks will want to write all their code in TypeScript. Especially if there's more going on than just configuring remix. In my case, I use HTTP mocks in dev mode and I want that code in TypeScript. I'd love it if remix could help me with this since it's compiling everything else for me. Just feels like a poor DX experience to have to do something extra to get this working when none of my other code needs extra tooling figured out.
Received this error with initial repo installation. (node v10 & v12)
npm ERR! code E404
npm ERR! 404 Not Found - GET https://registry.npmjs.org/@remix-run%2fexpress - Not found
npm ERR! 404
npm ERR! 404 '@remix-run/[email protected]' is not in the npm registry.
npm ERR! 404 You should bug the author to publish it (or use the name yourself!)
npm ERR! 404 It was specified as a dependency of 'starter-express'
I'm trying to follow the example in the docs and it seems that team is not getting written to data-build/routes despite being present in the same places as the gist example. npm run dev
doesn't seem to build the app correctly
Update: I manually added team.js to data-build/routes and got the Team component to render, however this does not solve the build issue
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.loader = void 0;
let loader = async () => {
return fetch("https://api.github.com/orgs/reacttraining/members");
};
exports.loader = loader;
EDIT: node version 14.15.0
Scripts set NODE_ENV the unix way. Windows would be set NODE_ENV=developement
. I THINK separating the env variable and concurrently bit with ;
should work, but is failing for me.
To test I removed the NODE_ENV part and get the following when hitting localhost:3000
Cannot find module ./App.tsx
I cloned a new version of the starter-express, but when I go to run npm run dev
I get the following error:
> [email protected] dev C:\Users\mikey\Websites\express_tester
> pm2-dev pm2.config.js
[
Error: Script not found: C:\Users\mikey\Websites\express_tester\remix run
at Object.Common.resolveAppAttributes (C:\Users\mikey\Websites\express_tester\node_modules\pm2\lib\Common.js:644:11)
at C:\Users\mikey\Websites\express_tester\node_modules\pm2\lib\API.js:1132:35
at C:\Users\mikey\Websites\express_tester\node_modules\async\internal\withoutIndex.js:8:40
at replenish (C:\Users\mikey\Websites\express_tester\node_modules\async\internal\eachOfLimit.js:81:17)
at C:\Users\mikey\Websites\express_tester\node_modules\async\internal\eachOfLimit.js:86:9
at eachLimit (C:\Users\mikey\Websites\express_tester\node_modules\async\eachLimit.js:47:43)
at awaitable (C:\Users\mikey\Websites\express_tester\node_modules\async\internal\awaitify.js:13:28)
at startApps (C:\Users\mikey\Websites\express_tester\node_modules\pm2\lib\API.js:1116:7)
at C:\Users\mikey\Websites\express_tester\node_modules\pm2\lib\API.js:1097:16
at wrapper (C:\Users\mikey\Websites\express_tester\node_modules\async\internal\once.js:12:16)
]
Windows 10
Node v12.21.0
npm v6.14.11
Starter express version current as of 4th March 2021.
Remix v13.0
pm2 v4.5.4
VS Code already complains about the missing React imports in the modules and build fails due to the same issue.
npm run build
> [email protected] build /home/main/projects/remix/starter-express
> remix build && tsc -b
Building Remix app for production...
done!
app/App.tsx:7:6 - error TS2686: 'React' refers to a UMD global, but the current file is a module. Consider adding an import instead.
7 <html lang="en">
~~~~
app/App.tsx:8:8 - error TS2686: 'React' refers to a UMD global, but the current file is a module. Consider adding an import instead.
8 <head>
~~~~
It seemed loaders suddenly stopped working in my side project, so I tried to verify against a clean install of the starter and still having problems. Any idea what I could be doing wrong here?
git clone [email protected]:remix-run/starter-express.git my-remix-app
.npmrc
nvm use 12
npm install
npm run dev
The page loads
In root.tsx
, should probably read root.tsx
instead of App.tsx
?
Line 50 in fde4506
I wanted to import some test JSON data.
// data/routes/cybermonday-blackfriday/index.ts
import type { Loader } from '@remix-run/data'
import * as data from '../../../json/test-items.json'
export const loader: Loader = () => {
return data
}
As you can see, json
directory is a sibling of data
directory.
Running tsc -b
now results in a data-build
directory like:
data-build
├── data
│ ├── global.js
│ └── routes
│ ├── cybermonday-blackfriday
│ │ └── index.js
│ └── index.js
└── json
└── test-items.json
4 directories, 4 files
Which causes some problems when launching Remix, as it's expecting a data-build/routes
directory which is not there in this case.
Changing the data loader to
import type { Loader } from '@remix-run/data'
//import * as data from '../../../json/test-items.json'
export const loader: Loader = () => {
return null
}
and rerunning tsc -b
:
data-build
├── data
│ ├── global.js
│ └── routes
│ ├── cybermonday-blackfriday
│ │ └── index.js
│ └── index.js
├── global.js
├── json
│ └── test-items.json
└── routes
├── cybermonday-blackfriday
│ └── index.js
└── index.js
6 directories, 7 files
Which correctly outputs the data-build/routes
directory but doesn't seem to clean up the previous build. Are we supposed to manually clean these up?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.