thetarnav / solid-devtools

Library of developer tools, reactivity debugger & Devtools Chrome extension for visualizing SolidJS reactivity graph
https://chrome.google.com/webstore/detail/solid-devtools/kmcfjchnmmaeeagadbhoofajiopoceel
MIT License
536 stars 21 forks source link

This package is ESM only but it was tried to load by `require` #288

Closed EliasDerHai closed 8 months ago

EliasDerHai commented 8 months ago

I followed: https://github.com/thetarnav/solid-devtools/tree/main/packages/extension#getting-started

I have:

"solid-js": "^1.8.7", "solid-devtools": "^0.27.9",

When I run npm run dev I get

✘ [ERROR] Failed to resolve "solid-devtools/vite". This package is ESM only but it was tried to load by require. See http://vitejs.dev/guide/troubleshooting.html#this-package-is-esm-only for more details. [plugin externalize-deps] node_modules/esbuild/lib/main.js:1373:27: 1373 │ let result = await callback({

I havent changed much in my vite.config

import { defineConfig } from 'vite';
import solidPlugin from 'vite-plugin-solid';
import devtools from 'solid-devtools/vite';

export default defineConfig({
  plugins: [
    /* 
    Uncomment the following line to enable solid-devtools.
    For more info see https://github.com/thetarnav/solid-devtools/tree/main/packages/extension#readme
    */
    devtools(),
    solidPlugin(),
  ],
  server: {
    port: 3000,
  },
  build: {
    target: 'esnext',
  },
});

and am simply importing the runtime in index.ts:

import 'solid-devtools';

EliasDerHai commented 8 months ago

Should have just checked http://vitejs.dev/guide/troubleshooting.html#this-package-is-esm-only maybe still the docs could be updated regarding this step.

thetarnav commented 8 months ago

I think you’re right. At this point I’m too used to esm to have thought about it.