Comments (9)
I think I fixed it in 2.2.3.
This commit broke array merging with empty arrays: vitejs/vite#6344
And this seems to not get tripped up by it: 166554e#diff-a2a171449d862fe29692ce031981047d7ab755ae7f84c707aef80701b3ea0c80L339
from vite-plugin-solid.
I think I fixed it in 2.2.3.
This commit broke array merging with empty arrays: vitejs/vite#6344 And this seems to not get tripped up by it: 166554e#diff-a2a171449d862fe29692ce031981047d7ab755ae7f84c707aef80701b3ea0c80L339
Commit breaks for merging user-defined plugins on Windows (not sure if related). I think the merging utility function is what causes issues here.
from vite-plugin-solid.
Tried logging the 3 conditions. So the real issue here is needHmr
, so I checked the configResolved
!config.isProduction
is causing the issues. I logged the config
{
plugins: [
{
name: 'vite:pre-alias',
configureServer: [Function: configureServer],
resolveId: [Function: resolveId]
},
{
name: 'alias',
buildStart: [Function: buildStart],
resolveId: [Function: resolveId]
},
{
name: 'solid',
enforce: 'pre',
config: [Function: config],
configResolved: [Function: configResolved],
resolveId: [Function: resolveId],
load: [Function: load],
transform: [AsyncFunction: transform]
},
{
name: 'vite:modulepreload-polyfill',
resolveId: [Function: resolveId],
load: [Function: load]
},
{
name: 'vite:resolve',
configureServer: [Function: configureServer],
resolveId: [Function: resolveId],
load: [Function: load]
},
{
name: 'vite:html-inline-script-proxy',
resolveId: [Function: resolveId],
buildStart: [Function: buildStart],
load: [Function: load]
},
{
name: 'vite:css',
configureServer: [Function: configureServer],
buildStart: [Function: buildStart],
transform: [AsyncFunction: transform]
},
{
name: 'vite:esbuild',
configureServer: [Function: configureServer],
transform: [AsyncFunction: transform]
},
{ name: 'vite:json', transform: [Function: transform] },
{
name: 'vite:wasm',
resolveId: [Function: resolveId],
load: [AsyncFunction: load]
},
{
name: 'vite:worker',
load: [Function: load],
transform: [AsyncFunction: transform]
},
{
name: 'vite:asset',
buildStart: [Function: buildStart],
resolveId: [Function: resolveId],
load: [AsyncFunction: load],
renderChunk: [Function: renderChunk],
generateBundle: [Function: generateBundle]
},
{ name: 'vite:define', transform: [Function: transform] },
{
name: 'vite:css-post',
buildStart: [Function: buildStart],
transform: [AsyncFunction: transform],
renderChunk: [AsyncFunction: renderChunk],
generateBundle: [AsyncFunction: generateBundle]
},
{ name: 'vite:client-inject', transform: [Function: transform] },
{
name: 'vite:import-analysis',
configureServer: [Function: configureServer],
transform: [AsyncFunction: transform]
}
],
server: {
preTransformRequests: true,
fs: { strict: true, allow: [Array], deny: [Array] }
},
resolve: {
dedupe: [
'solid-js',
'solid-js/web',
'solid-js/store',
'solid-js/html',
'solid-js/h'
],
alias: [ [Object], [Object], [Object] ],
conditions: [ 'solid', 'development' ]
},
esbuild: { include: /\.ts$/ },
optimizeDeps: {
include: [
'solid-js',
'solid-js/web',
'solid-js/store',
'solid-js/html',
'solid-js/h'
],
esbuildOptions: { keepNames: undefined, preserveSymlinks: undefined }
},
configFile: 'F:/Files/Github/solid-sfc/examples/counter/vite.config.js',
configFileDependencies: [ 'vite.config.js' ],
inlineConfig: {
root: undefined,
base: undefined,
mode: undefined,
configFile: undefined,
logLevel: undefined,
clearScreen: undefined,
server: {}
},
root: 'F:/Files/Github/solid-sfc/examples/counter',
base: '/',
publicDir: 'F:\\Files\\Github\\solid-sfc\\examples\\counter\\public',
cacheDir: 'F:\\Files\\Github\\solid-sfc\\examples\\counter\\node_modules\\.vite',
command: 'serve',
mode: 'development',
isProduction: true,
build: {
target: [ 'es2019', 'edge88', 'firefox78', 'chrome87', 'safari13.1' ],
polyfillModulePreload: true,
outDir: 'F:\\Files\\Github\\solid-sfc\\examples\\counter\\dist',
assetsDir: 'assets',
assetsInlineLimit: 4096,
cssCodeSplit: true,
cssTarget: [ 'es2019', 'edge88', 'firefox78', 'chrome87', 'safari13.1' ],
sourcemap: false,
rollupOptions: {},
minify: 'esbuild',
terserOptions: {},
write: true,
emptyOutDir: null,
manifest: false,
lib: false,
ssr: false,
ssrManifest: false,
reportCompressedSize: true,
chunkSizeWarningLimit: 500,
watch: null,
commonjsOptions: { include: [Array], extensions: [Array] },
dynamicImportVarsOptions: { warnOnError: true, exclude: [Array] }
},
preview: {
port: undefined,
strictPort: undefined,
host: undefined,
https: undefined,
open: undefined,
proxy: undefined,
cors: undefined
},
env: { BASE_URL: '/', MODE: 'development', DEV: false, PROD: true },
assetsInclude: [Function: assetsInclude],
logger: {
hasWarned: false,
info: [Function: info],
warn: [Function: warn],
warnOnce: [Function: warnOnce],
error: [Function: error],
clearScreen: [Function: clearScreen],
hasErrorLogged: [Function: hasErrorLogged]
},
packageCache: Map(0) {},
createResolver: [Function: createResolver]
}
If we look closely at mode
and env.mode
, both have the values of development
, which is weird given the following code:
https://github.com/vitejs/vite/blob/b2d972e53b59329695f74e01893b21ec5c136ffd/packages/vite/src/node/config.ts#L391-L395
Seems to me that the issue here is on Vite. Our softfix for now would be to use config.mode !== 'production'
instead of !config.isProduction
.
from vite-plugin-solid.
This PR might be related: vitejs/vite#6302
from vite-plugin-solid.
from vite-plugin-solid.
Investigated a little bit further, Vite looks up to the first .env
file it could find down to the root of the disk. Whoever thought this was a good idea?
from vite-plugin-solid.
I have the same issue, when I add refresh in vite config :
import { defineConfig } from 'vite';
import solidPlugin from 'vite-plugin-solid';
import solidRefresh from 'solid-refresh/babel';
export default defineConfig({
plugins: [solidPlugin({
babel: {
plugins: [
[solidRefresh, { bundler: 'vite'}],
],
},
})],
build: {
target: 'esnext',
polyfillDynamicImport: false,
},
});
I got this error:
12:18:44 [vite] Internal server error: Duplicate plugin/preset detected.
If you'd like to use two separate instances of a plugin,
they need separate names, e.g.
plugins: [
['some-plugin', {}],
['some-plugin', {}, 'some unique name'],
]
Duplicates detected are:
[
{
"alias": "base$0",
"options": {
"bundler": "vite"
},
"dirname": "/Users/efxair/Desktop/dev/solidtuts/my-app",
"ownPass": false
},
{
"alias": "base$1",
"options": {
"bundler": "vite"
},
"dirname": "/Users/efxair/Desktop/dev/solidtuts/my-app",
"ownPass": false
}
]
Plugin: solid
File: /Users/efxair/Desktop/dev/solidtuts/my-app/src/index.jsx
at assertNoDuplicates (/Users/efxair/Desktop/dev/solidtuts/my-app/node_modules/@babel/core/lib/config/config-descriptors.js:239:13)
at createDescriptors (/Users/efxair/Desktop/dev/solidtuts/my-app/node_modules/@babel/core/lib/config/config-descriptors.js:147:3)
at createDescriptors.next (<anonymous>)
at createPluginDescriptors (/Users/efxair/Desktop/dev/solidtuts/my-app/node_modules/@babel/core/lib/config/config-descriptors.js:138:17)
at createPluginDescriptors.next (<anonymous>)
at /Users/efxair/Desktop/dev/solidtuts/my-app/node_modules/@babel/core/lib/config/config-descriptors.js:94:32
at Generator.next (<anonymous>)
at Function.<anonymous> (/Users/efxair/Desktop/dev/solidtuts/my-app/node_modules/@babel/core/lib/gensync-utils/async.js:25:3)
at Generator.next (<anonymous>)
at step (/Users/efxair/Desktop/dev/solidtuts/my-app/node_modules/gensync/index.js:261:32)
from vite-plugin-solid.
@electroheadfx solid-refresh
is already included in the plugin, hence why you experience that problem.
from vite-plugin-solid.
you are right. in my setup:
npx degit solidjs/templates/js my-app
cd my-app/
npm i
code .
npm run dev
I have not browser refreshing when I modify the app file. It refresh only if I add : /* @refresh reload */
at app file header. Sorry for the confusion.
from vite-plugin-solid.
Related Issues (20)
- Upgrade compatibility with Vite 5 HOT 3
- alias normalization breaks config
- Not working with happy-dom
- 2.8.1 vite dev server : Uncaught ReferenceError: _tmpl$ is not defined HOT 6
- Interpolation syntax error causes unhelpful "Invalid raw" error
- scope.registerDeclaration(declarationPath) error with vite-plugin-solid 2.8.2 HOT 6
- peerDependencyMeta in package.json should be peerDependenciesMeta
- vite-plugin-solid v2.8.3+ causes: `TypeError: Cannot read properties of undefined (reading 'extend')`
- missing changelog / release tags HOT 1
- optimizeDeps.include will produce the React version of the jsx result HOT 1
- I updated `vite-plugin-solid` and now namespaces merged with components are no longer allowed HOT 11
- Unable to pass signal to child components HOT 5
- Breaking updating from v2.9.1 from v2.10.0 HOT 1
- Should omitNestedClosingTags be actually required? HOT 1
- HMR not work in "solid-ts" template HOT 1
- Vite does not load proper build (server) on ssr webworker build HOT 4
- feature: SWC support
- Put packge into `@solidjs` namespace
- Vitest fails with TypeError: Unknown file extension ".jsx" HOT 5
- [vite] server connection lost. Polling for restart...
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from vite-plugin-solid.