-
Notifications
You must be signed in to change notification settings - Fork 123
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
problem customising viteconfig #406
Comments
I'm assuming you also get the "The CJS build of Vite's Node API is deprecated. See https://vitejs.dev/guide/troubleshooting.html#vite-cjs-node-api-deprecated for more details." error when you build. This is because you're using the common js version of vite (as we show in the tutorial for maximum backward compatibility) and that package is esm. You have several options: 1. use esm for vite only:
2. Change the entire node js project to esm
import {api} from './api.js' Let me know that it worked for you |
I used the second proposal , and to modify a bit the server //index.ts
|
Great - would you be willing to do a PR and update the tutorial to use ESM to begin with? (remove the text about removing "type":"module" and make the adjustments you did? |
Yes,I can. let me get a little time to dit it next week. |
Modified documentation to use ESM module instead of cjs for deployment. refs remult#406
Hi, I made a pull request. When working again on it trying to deploy, I faced problems where node was unable to load the .js file as esm module. |
Hi @sancelot - can you share the code you played with - or the final result? I didn't run into this problem in my conference talks where I use esm - here's my starting repo: |
Did you deploy only the dist folder - or the entire folder? |
I deployed the dist folder. I can not share code . I made a small mistake in the PR , I will correct |
Ok - in the tutorial we deploy the entire folder. If you only deploy the dist folder, you anyhow need another package json to instruct node to install pg for postgres etc... |
At the moment I stick to json db.
|
Gotit - I'll make a few adjustments and merge it |
* [doc] Deployment using ESM module Modified documentation to use ESM module instead of cjs for deployment. refs #406 * Update deployment.md
I've merged your PR and did a few more adjustments to the tutorials - check it out at: |
Describe the bug
I wanted to add a plugin to copy static files folder in my dist folder , but build failed
To Reproduce
installed vite plugin static copy and import it in vite.config.ts
npm i -D vite-plugin-static-copy
// vite.config.js / vite.config.ts
import { viteStaticCopy } from 'vite-plugin-static-copy'
Expected behavior
I can use plugin
Screenshots
X [ERROR] "vite-plugin-static-copy" resolved to an ESM file. ESM file cannot be loaded by
require
. See https://vitejs.dev/guide/troubleshooting.html#this-package-is-esm-only for more details. [plugin externalize-deps]Desktop (please complete the following information):
The text was updated successfully, but these errors were encountered: