Open lieser opened 4 years ago
Are you hitting this problem: https://github.com/stoically/webextensions-api-mock/issues/7?
No, for me it fails earlier. Could be that Karma runner already did run browserify or something similar.
What I'm trying to do, is directly include what is packed inside the node package in an html page, that I open in a Browser (Firefox). For chai/mocha/sinon, this works:
<script src="https://unpkg.com/chai/chai.js"></script>
<script src="https://unpkg.com/mocha/mocha.js"></script>
<script src="https://unpkg.com/sinon/pkg/sinon.js"></script>
For webextensions-api-fake, with
<script src="https://unpkg.com/webextensions-api-fake/dist/index.js"></script>
I get the following error :
ReferenceError: exports is not defined - index.js:15:1
<anonym> https://unpkg.com/webextensions-api-fake/dist/index.js:15
An then I try to load it as a module with
<script type="module" src="https://unpkg.com/webextensions-api-fake/dist/index.js"></script>
I get:
ReferenceError: exports is not defined - index.js:15:1
<anonym> https://unpkg.com/webextensions-api-fake/dist/index.js:15
InnerModuleEvaluation self-hosted:1572
evaluation self-hosted:1543
Similar results with webextensions-api-mock
.
For my use case to work, the build process would probably needed to be updated to include browserify or some different bundler.
I run my tests not just in node, but also in the browser. So it would be nice if the build could generate a script that can be directly included in a browser.