V
V
Vladislav Filippov2016-03-21 11:40:41
Node.js
Vladislav Filippov, 2016-03-21 11:40:41

How to include js library in Electron.js?

good afternoon!
I'm writing an Electron.js app and want to use my own js library built with Browserify.
I include the library in index.html as a regular script in HEAD and try to use it in javascript

var Converter = require('./libs/cadXML2GeoJSON.js');

As a result, I get an empty object {} in the Converter.
What am I doing wrong?
ps
tried to connect like this:
<script>window.Converter = require('./libs/cadXML2GeoJSON.js');</script>

same result - empty object {}

Answer the question

In order to leave comments, you need to log in

2 answer(s)
D
Dmitry Belyaev, 2016-03-21
@bingo347

Firstly, electron does not need browserify, it even holds common-js modules without it
Secondly, the plug-in must write something to module.exports so that it would be available from the outside

V
Vladislav Filippov, 2016-03-22
@filippov70

Dmitry, the library lives by itself without knowing about Electron.
The link shows that the library exports (module.exports.GeoJSON = function (xmlData, reproject) {.....)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question