wallabyjs / quokka

Repository for Quokka.js questions and issues
https://quokkajs.com
1.18k stars 31 forks source link

Quokka cannot find module in project sub-directory's node_modules #332

Open inithink opened 5 years ago

inithink commented 5 years ago

Issue description or question

I'm using both quokka.js and wallaby.js.

I appreciate for exist of Quokka and wallaby! The apps make my life easier :)

I'm developing server, web in one project.

My project structure like this. project // Intellij project --web // Intellij module ----node_modules ----... --server // Intellij module ----node_modules ------joi ----...

When I opened project, and using Quokka, Quokka cannot find a module. This problem may be resolved using some configurations. But Intellij already has information of module (web, server).

My question is...

  1. Will Quokka support this? (Support module in sub module's node_modules)
  2. Can I use Quokka with this structure? (some configuration?)

Sample code

const Joi = require('joi');

Quokka.js Console Output

Cannot find module 'joi'

Code editor version

Intellij 2019 EAP

OS name and version

Windows 10

smcenlly commented 5 years ago

This isn't something that we officially support right now so I'm going to mark with a feature request.

For IntelliJ editors, you should be able to run Quokka on your files that are saved under each project directory. If you create a scratch file, it will only look for node_modules under the project directory (not web or server).

kutenai commented 5 years ago

This is a major pain point for me also. I really think you could elevate the priority here. One suggestion would be to allow the quokka config file at the top level to define where to find things like node_modules (i.e. in a sub-directory), so that I can use the scratch files with quokka.

kutenai commented 5 years ago

Also - a workaround for me was to "link" my sub-directory package.json and run that in the top level. This causes other issues but allows quokka to run at least.