2.1.0 • Published 4 years ago
parcel-plugin-tampermonkey-js v2.1.0
parcel-plugin-tampermonkey-js
create tampermonkey meta
.tampermonkey-config.js config
keywords reference https://www.tampermonkey.net/documentation.php
module.exports = {
name: 'project name',
version: '1.0.0',
description: 'xxx',
author: 'xxxx',
namespace: '',
updateURL: 'xx.com/xx.meta.js',
match: ['*://xx.com/*'],
connect: ['xx.com'],
require: [],
grant: ['GM_getValue', 'GM_setValue', 'GM_notification', 'GM_xmlhttpRequest'],
configurations: {
production: {
baseURL: 'http://xx.com',
suffixParms: '?auth_code=xxxx'
},
development: {
// assign local server address
baseURL: 'http://127.0.0.1:1234',
// option
suffixParms: '?auth_code=xxxx'
}
}
};
TM_ENV=production or TM_ENV=development Different environment
// package.json#scripts
"scripts": {
"start": "npm run watch",
"build": "NODE_ENV=production TM_ENV=production parcel build src/index.tsx",
"watch": "NODE_ENV=production TM_ENV=development parcel watch src/index.tsx --no-hmr"
},