Comments (2)
@richardtape you are right. elemon
is a tool that you need it only in development. Essentially, in order to achieve what you want, I can think of 3 ways at this moment. Methods 2 and 3 require to use electron-is-dev.
- Have 2 different
package.json
files. This refers to twopackage.json
structure. elemon
useselectron-is-dev
internally. Then, users install it likenpm i elemon --save
. This means users don't need to guard it for production. However, I don't like this becauseelemon
has a dependency (chokidar) and it means all these dependency modules will be bundled in your final app while you don't need them.- Users (like you) use
electron-is-dev
and useelemon
like the following example. I believe this is better sinceelectron-is-dev
is just 2 lines of code and doesn't have any dependencies. So, it basically doesn't hurt to be included in your final app in terms of size and other stuff.
So, you can do something like this:
npm i electron-is-dev --save
npm i elemon --save-dev
const {app, BrowserWindow} = require('electron')
const isDev = require('electron-is-dev')
function createWindows () {
// ...
}
app.on('ready', () => {
createWindows()
if (isDev) {
const elemon = require('elemon') // require elemon if electron is in dev
elemon({
app: app,
mainFile: 'main.js',
bws: [
{bw: win1, res: ['win1.html', 'win1.js', 'style.css']},
{bw: win2, res: ['win2.html', 'win2.js', 'style.css']}
]
})
}
})
Hopefully this helps you in your issue. Please let us know if you need further assistance.
from elemon.
This feature is documented now. Please reopen if needed.
from elemon.
Related Issues (1)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from elemon.