Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Vite example not working on windows 10 #17

Open
J-Hoh opened this issue Aug 4, 2021 · 1 comment
Open

Vite example not working on windows 10 #17

J-Hoh opened this issue Aug 4, 2021 · 1 comment

Comments

@J-Hoh
Copy link

J-Hoh commented Aug 4, 2021

The current marko-vite example as-is does not work under windows environments.

First Error would be:

PS D:\DEV\marko-vite> npm run dev

> marko-vite@1.0.0 dev D:\DEV\marko-vite
> node --enable-source-maps index.js

Listening on port 3000
12:34:56 [vite] Internal server error: ENOENT: no such file or directory, open 'D:\DEV\marko-vite\D:\DEV\marko-vite\src\pages\index\template.marko'

Which can be fixed by adding root: "./" to the vite.config object. Afterwards you can run the example in dev mode 🎉


Cue the next problem:

building for production:

PS D:\DEV\marko-vite> npm run build

> marko-vite@1.0.0 build D:\DEV\marko-vite
> rimraf dist && npm run build:server && npm run build:client


> marko-vite@1.0.0 build:server D:\DEV\marko-vite
> cross-env NODE_ENV=production vite build --ssr src/index.js

vite v2.4.4 building SSR bundle for production...
✓ 32 modules transformed.
dist/index.js   101.14kb

> marko-vite@1.0.0 build:client D:\DEV\marko-vite
> cross-env NODE_ENV=production vite build

vite v2.4.4 building for production...
✓ 4 modules transformed.
[vite]: Rollup failed to resolve import "src\\pages\\index\\template.marko?marko-browser-entry" from "src\pages\index\template.marko.html".
This is most likely unintended because it can break your application at runtime.
If you do want to externalize this module explicitly add it to
`build.rollupOptions.external`
error during build:
Error: [vite]: Rollup failed to resolve import "src\\pages\\index\\template.marko?marko-browser-entry" from "src\pages\index\template.marko.html".
This is most likely unintended because it can break your application at runtime.
If you do want to externalize this module explicitly add it to
`build.rollupOptions.external`
    at onRollupWarning (D:\DEV\marko-vite\node_modules\vite\dist\node\chunks\dep-c1a9de64.js:51765:19)
    at onwarn (D:\DEV\marko-vite\node_modules\vite\dist\node\chunks\dep-c1a9de64.js:51550:13)
    at Object.onwarn (D:\DEV\marko-vite\node_modules\rollup\dist\shared\rollup.js:20494:13)
    at ModuleLoader.handleResolveId (D:\DEV\marko-vite\node_modules\rollup\dist\shared\rollup.js:19843:26)
    at D:\DEV\marko-vite\node_modules\rollup\dist\shared\rollup.js:19790:22
    at async Promise.all (index 0)
    at async ModuleLoader.fetchStaticDependencies (D:\DEV\marko-vite\node_modules\rollup\dist\shared\rollup.js:19788:34)
    at async Promise.all (index 0)
    at async ModuleLoader.fetchModule (D:\DEV\marko-vite\node_modules\rollup\dist\shared\rollup.js:19764:9)
    at async Promise.all (index 0)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! marko-vite@1.0.0 build:client: `cross-env NODE_ENV=production vite build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the marko-vite@1.0.0 build:client script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

With this error my knowledge of vite ends. I'm terribly sorry if this is an error with vite and not any part of the marko "ecosystem".

Everything is working on a random linux distro aswell as raspbian 10; but production building is not working on windows 10.
The webpack example (or rather my project build upon the webpack example) works on my machine (win10).

Package versions
  • Node 14 / 15
  • @marko/express 1.0.0
  • @marko/vite 2.0.0
  • @marko/compiler 5.15.0
  • marko 5.15.1
  • compression 1.7.4
  • express 4.17.1
  • raptor-pubsub 1.0.5
  • cross-env 7.0.3
  • marked 2.1.3
  • rimraf 3.0.2
  • vite 2.4.4
@asieverding
Copy link

I have the same issue, please help.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants