📦 JSBox meets Webpack
We have prepared a scaffolding tool (thanks to saojs) for you, to help you start using Webpack to develop JSBox applications more efficiently.
Please ensure that your NPM client is ready, which should be installed with Node.js.
Just run:
mkdir myapp && cd myapp
npx sao sao-jsbox-webpack
Then everything out of the box is ready for you. 🎉
- Set your iPhone's IP (you can find it in JSBox's Setting Tab) into the environment variable
JSBOX_HOST
. - Run
npm start
(development mode) /npm run build
(production mode) to compiling the codes, and the assembled box file would be sync to your phone automatically while theupload
option is turned on.
GLHF 😉
const { resolve } = require('path')
const JSBoxPlugin = require('jsbox-webpack-plugin')
module.exports = {
context: resolve('src'),
entry: './scripts/main.js',
output: {
path: resolve(`dist`),
filename: 'scripts/main.js',
},
plugins: [
new JSBoxPlugin(/* options */),
],
}
Arguments:
copy: [fromPath: string]
copy: [{ fromPath: string, toRelativePath: string }]
Default Value: []
Basic Example:
// ...
new JSBoxPlugin({
copy: [
'beta.json',
],
}),
// ...
In case of copying files out of the context:
const { resolve } = require('path')
// ...
new JSBoxPlugin({
copy: [
[resolve(__dirname, 'README.md'), 'README.md],
],
}),
// ...
Arguments:
upload: boolean
Default Value: false
Important: Should be used with env variable JSBOX_HOST
Example:
// ...
new JSBoxPlugin({
upload: true,
}),
// ...
and then
JSBOX_HOST=192.168.1.10 npx webpack
Arguments:
upload: number
Default Value: 10 * 1000
(ms)
Example:
// ...
new JSBoxPlugin({
upload: true,
uploadTimeout: 2 * 1000,
}),
// ...
Apache-2.0 © yelo, 2019 - present