wallabyjs / quokka

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

Exclude lines / limit quokka scope #131

Open pastinepolenta opened 6 years ago

pastinepolenta commented 6 years ago

Issue description or question

I am a free user (for now) and I get ​​Only 'Pro' edition of Quokka.js supports project files import. The thing is, I would like to use Quokka in parts of the files that don't need the "project files import" I can of course copy those functions in a clean file but that is more time consuming. Can Quokka simply ignore the local imports if they are not supported in free version ?

Sample code

// paste the code you are running here
import somethinglocal from './local.js'
// and then you are doomed

Quokka.js Console Output

// paste your quokka console output here
Only 'Pro' edition of Quokka.js supports project files import

Code editor version

Visual Studio Code v1.18.1

OS name and version

Windows but irrelevant

ArtemGovorov commented 6 years ago

Ignoring imports by default would be misleading, as it may cause various errors in code that uses them (instead of an existing clear message of what is going on).

However, I like the idea of being able to mock all/some imported modules. As a matter of fact, it is doable now via Quokka plugin in few lines of code. For example, one may intercept the Module._load function, and if local file is imported, return some mock/stub instead of loading the file.

The plugin would work for both free and pro version, so can be useful for everyone. Would you be interested to create and share a plugin like this?

pastinepolenta commented 6 years ago

Thanks for the info, its a good idea. Will it still require the pro version or quokka free detecting the mock will work?

ArtemGovorov commented 6 years ago

Such plugin will work for both free and Pro versions.