
Security News
GitHub Actions Checkout Now Blocks Risky pull_request_target Checkouts
GitHub Actions checkout now blocks risky pull_request_target checkouts by default to help prevent pwn request supply chain attacks.
jtaro-bundle
Advanced tools
为JTaro服务的打包脚本
npm install -D jtaro-bundle
选项:
| 键 | 值 | 必填 | 备注 |
|---|---|---|---|
| origin | <String> | Y | 开发目录的index.html |
| target | <String> | Y | 生产目录的index.html模板 |
| copies | <Array> | N | 直接拷贝的文件(夹) |
| rollupPlugins | <Array> | N | 参考 Rollup JavaScript-API#plugins |
| sourceMap | <Boolean> | N | 默认为false,是否开启sourceMap |
| callback | <Function> | N | 打包完成后执行的回调 |
示例:
// nodejs
var jtaroBundle = require('jtaro-bundle')
var uglify = require('rollup-plugin-uglify')
var babel = require('rollup-plugin-babel')
jtaroBundle.bundle({
origin: 'dev/index.html', // 开发目录的index.html
target: 'pro/index_template.html', // 生产目录的index.html模板
// 直接拷贝的文件(夹),注意:文件夹后不要带/,否则windows10拷贝的文件会有问题,例:./assets不要写成./assets/
copies: ['./data.json', './assets'],
// 自定义使用rollup打包时使用的插件
// uglify不能压缩ES6语法,所以babel要放在uglify前面
rollupPlugins: [babel({
include: './dev/pages/*.js', // 相对于该脚本文件(请注意区分与jtaro-module的babel插件路径)
presets: [
[
'es2015',
{
'modules': false
}
]
]
},
uglify()],
sourceMap: true,
callback: function () {
console.log('打包完成')
}
})
用于将文件夹里所有js文件索引到一个js文件里,给rollup.js提供入口
require('jtaro-bundle').index(path[, name])
<目录名> + _index.jsvar jtaroBundle = require('jtaro-bundle')
jtaroBundle.index('dev/pages')
// jtaroBundle.index('dev/pages', 'myIndex.js') // 自定义文件名
将会生成dev/pages.js文件,dev/pages.js文件内容类似如下形式,引入js并创建Vue组件
import p2 from './pages/detail.js'
Vue.component('pages__detail', p2)
import p4 from './pages/home.js'
Vue.component('pages__home', p4)
import p8 from './pages/reply.js'
Vue.component('pages__reply', p8)
.报错的问题rollup-plugin-jtaro-module@0.2.0rollup-plugin-jtaro-module@0.1.0rollup-plugin-jtaro-module@0.0.7\反斜杠路径错误的问题\反斜杠路径错误的问题FAQs
A bundle plugin for JTaro
We found that jtaro-bundle demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
GitHub Actions checkout now blocks risky pull_request_target checkouts by default to help prevent pwn request supply chain attacks.

Product
Socket now supports Custom Roles and Repository Access Permissions so organizations can control who can access specific repositories and actions.

Product
Socket MCP now lets AI assistants review org alerts, investigate threats using the Socket threat feed, and inspect package files in addition to dependency scoring.