fixes rollup bundling
This commit is contained in:
parent
5a8ba507c1
commit
91ac63dcb6
|
|
@ -3,17 +3,20 @@
|
|||
const path = require('path')
|
||||
const { babel } = require('@rollup/plugin-babel')
|
||||
const { nodeResolve } = require('@rollup/plugin-node-resolve')
|
||||
import multi from '@rollup/plugin-multi-entry'
|
||||
const banner = require('./banner.js')
|
||||
|
||||
let fileDest = 'theme.js'
|
||||
const external = ['jquery', 'popper.js']
|
||||
const external = ['jquery']
|
||||
const plugins = [
|
||||
babel({
|
||||
// Only transpile our source code
|
||||
exclude: 'node_modules/**',
|
||||
// Include the helpers in the bundle, at most one copy of each
|
||||
babelHelpers: 'bundled'
|
||||
})
|
||||
}),
|
||||
nodeResolve(),
|
||||
multi()
|
||||
]
|
||||
const globals = {
|
||||
jquery: 'jQuery', // Ensure we use jQuery which is always available even in noConflict mode
|
||||
|
|
@ -21,15 +24,8 @@ const globals = {
|
|||
}
|
||||
|
||||
|
||||
fileDest = 'theme.js'
|
||||
// Remove last entry in external array to bundle Popper
|
||||
external.pop()
|
||||
delete globals['popper.js']
|
||||
plugins.push(nodeResolve())
|
||||
|
||||
|
||||
module.exports = {
|
||||
input: path.resolve(__dirname, '../src/js/custom-javascript.js'),
|
||||
input: [path.resolve(__dirname, '../src/js/bootstrap.js'), path.resolve(__dirname, '../src/js/skip-link-focus-fix.js'), path.resolve(__dirname, '../src/js/custom-javascript.js')],
|
||||
output: {
|
||||
banner,
|
||||
file: path.resolve(__dirname, `../js/${fileDest}`),
|
||||
|
|
|
|||
5387
js/theme.js
5387
js/theme.js
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
|
@ -1188,6 +1188,16 @@
|
|||
}
|
||||
}
|
||||
},
|
||||
"@rollup/plugin-multi-entry": {
|
||||
"version": "4.1.0",
|
||||
"resolved": "https://registry.npmjs.org/@rollup/plugin-multi-entry/-/plugin-multi-entry-4.1.0.tgz",
|
||||
"integrity": "sha512-nellK5pr50W0JA2+bDJbG8F79GBP802J40YRoC0wyfpTAeAn5mJ4eaFiB/MN+YoX9hgb/6RJoZl9leDjZnUFKw==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@rollup/plugin-virtual": "^2.0.3",
|
||||
"matched": "^5.0.0"
|
||||
}
|
||||
},
|
||||
"@rollup/plugin-node-resolve": {
|
||||
"version": "13.0.4",
|
||||
"resolved": "https://registry.npmjs.org/@rollup/plugin-node-resolve/-/plugin-node-resolve-13.0.4.tgz",
|
||||
|
|
@ -1214,6 +1224,12 @@
|
|||
}
|
||||
}
|
||||
},
|
||||
"@rollup/plugin-virtual": {
|
||||
"version": "2.0.3",
|
||||
"resolved": "https://registry.npmjs.org/@rollup/plugin-virtual/-/plugin-virtual-2.0.3.tgz",
|
||||
"integrity": "sha512-pw6ziJcyjZtntQ//bkad9qXaBx665SgEL8C8KI5wO8G5iU5MPxvdWrQyVaAvjojGm9tJoS8M9Z/EEepbqieYmw==",
|
||||
"dev": true
|
||||
},
|
||||
"@rollup/pluginutils": {
|
||||
"version": "3.1.0",
|
||||
"resolved": "https://registry.npmjs.org/@rollup/pluginutils/-/pluginutils-3.1.0.tgz",
|
||||
|
|
@ -3262,6 +3278,16 @@
|
|||
}
|
||||
}
|
||||
},
|
||||
"matched": {
|
||||
"version": "5.0.1",
|
||||
"resolved": "https://registry.npmjs.org/matched/-/matched-5.0.1.tgz",
|
||||
"integrity": "sha512-E1fhSTPRyhAlNaNvGXAgZQlq1hL0bgYMTk/6bktVlIhzUnX/SZs7296ACdVeNJE8xFNGSuvd9IpI7vSnmcqLvw==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"glob": "^7.1.6",
|
||||
"picomatch": "^2.2.1"
|
||||
}
|
||||
},
|
||||
"memorystream": {
|
||||
"version": "0.3.1",
|
||||
"resolved": "https://registry.npmjs.org/memorystream/-/memorystream-0.3.1.tgz",
|
||||
|
|
@ -3681,6 +3707,12 @@
|
|||
"integrity": "sha1-7RQaasBDqEnqWISY59yosVMw6Qw=",
|
||||
"dev": true
|
||||
},
|
||||
"popper.js": {
|
||||
"version": "1.16.1",
|
||||
"resolved": "https://registry.npmjs.org/popper.js/-/popper.js-1.16.1.tgz",
|
||||
"integrity": "sha512-Wb4p1J4zyFTbM+u6WuO4XstYx4Ky9Cewe4DWrel7B0w6VVICvPwdOpotjzcf6eD8TsckVnIMNONQyPIUFOUbCQ==",
|
||||
"dev": true
|
||||
},
|
||||
"portscanner": {
|
||||
"version": "2.1.1",
|
||||
"resolved": "https://registry.npmjs.org/portscanner/-/portscanner-2.1.1.tgz",
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
"description": "WordPress Theme framework",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
"bs": "browser-sync start --config build/browser-sync.config.js",
|
||||
"bs": "browser-sync start --config build/browser-sync.config.js",
|
||||
"css": "npm-run-all css-compile css-postcss css-minify",
|
||||
"css-compile": "sass --style expanded --source-map --embed-sources --no-error-css sass/theme.scss:css/theme.css sass/custom-editor-style.scss:css/custom-editor-style.css",
|
||||
"css-minify": "cleancss -O1 --format breakWith=lf --with-rebase --source-map --source-map-inline-sources --output css/ --batch --batch-suffix \".min\" \"css/*.css\" \"!css/*.min.css\" \"!css/*rtl*.css\"",
|
||||
|
|
@ -13,7 +13,7 @@
|
|||
"js-compile": "rollup --config build/rollup.config.js --sourcemap",
|
||||
"js-minify": "terser --compress typeofs=false --mangle --comments \"/^!/\" --source-map \"content=js/theme.js.map,includeSources,url=theme.min.js.map\" --output js/theme.min.js js/theme.js",
|
||||
"watch": "npm-run-all --parallel watch-run-*",
|
||||
"watch-bs": "npm-run-all --parallel bs watch-run-*",
|
||||
"watch-bs": "npm-run-all --parallel bs watch-run-*",
|
||||
"watch-run-css": "nodemon --watch sass/ --ext scss --exec \"npm-run-all css\"",
|
||||
"watch-run-js": "nodemon --watch src/js/ --ext js --exec \"npm-run-all js\""
|
||||
},
|
||||
|
|
@ -45,6 +45,7 @@
|
|||
"@babel/preset-env": "^7.14.9",
|
||||
"@rollup/plugin-babel": "^5.3.0",
|
||||
"@rollup/plugin-commonjs": "^20.0.0",
|
||||
"@rollup/plugin-multi-entry": "^4.1.0",
|
||||
"@rollup/plugin-node-resolve": "^13.0.4",
|
||||
"autoprefixer": "^10.3.1",
|
||||
"bootstrap": "^4.6.0",
|
||||
|
|
@ -56,6 +57,7 @@
|
|||
"font-awesome": "^4.7.0",
|
||||
"nodemon": "^2.0.12",
|
||||
"npm-run-all": "^4.1.5",
|
||||
"popper.js": "^1.16.1",
|
||||
"postcss": "^8.3.6",
|
||||
"postcss-cli": "^8.3.1",
|
||||
"rollup": "^2.56.2",
|
||||
|
|
|
|||
|
|
@ -0,0 +1,29 @@
|
|||
import Popper from 'popper.js/src/index'
|
||||
import Alert from 'bootstrap/js/src/alert'
|
||||
import Button from 'bootstrap/js/src/button'
|
||||
import Carousel from 'bootstrap/js/src/carousel'
|
||||
import Collapse from 'bootstrap/js/src/collapse'
|
||||
import Dropdown from 'bootstrap/js/src/dropdown'
|
||||
import Modal from 'bootstrap/js/src/modal'
|
||||
import Popover from 'bootstrap/js/src/popover'
|
||||
import Scrollspy from 'bootstrap/js/src/scrollspy'
|
||||
import Tab from 'bootstrap/js/src/tab'
|
||||
import Toast from 'bootstrap/js/src/toast'
|
||||
import Tooltip from 'bootstrap/js/src/tooltip'
|
||||
import Util from 'bootstrap/js/src/util'
|
||||
|
||||
export {
|
||||
Popper,
|
||||
Util,
|
||||
Alert,
|
||||
Button,
|
||||
Carousel,
|
||||
Collapse,
|
||||
Dropdown,
|
||||
Modal,
|
||||
Popover,
|
||||
Scrollspy,
|
||||
Tab,
|
||||
Toast,
|
||||
Tooltip
|
||||
}
|
||||
|
|
@ -1,36 +1 @@
|
|||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
* Understrap (v1.0.0): index.js
|
||||
* Licensed under GPL (http://www.gnu.org/licenses/old-licenses/gpl-2.0.en.html)
|
||||
* --------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
import Alert from '../../node_modules/bootstrap/js/src/alert'
|
||||
import Button from '../../node_modules/bootstrap/js/src/button'
|
||||
import Carousel from '../../node_modules/bootstrap/js/src/carousel'
|
||||
import Collapse from '../../node_modules/bootstrap/js/src/collapse'
|
||||
import Dropdown from '../../node_modules/bootstrap/js/src/dropdown'
|
||||
import Modal from '../../node_modules/bootstrap/js/src/modal'
|
||||
import Popover from '../../node_modules/bootstrap/js/src/popover'
|
||||
import Scrollspy from '../../node_modules/bootstrap/js/src/scrollspy'
|
||||
import Tab from '../../node_modules/bootstrap/js/src/tab'
|
||||
import Toast from '../../node_modules/bootstrap/js/src/toast'
|
||||
import Tooltip from '../../node_modules/bootstrap/js/src/tooltip'
|
||||
import Util from '../../node_modules/bootstrap/js/src/util'
|
||||
|
||||
export {
|
||||
Util,
|
||||
Alert,
|
||||
Button,
|
||||
Carousel,
|
||||
Collapse,
|
||||
Dropdown,
|
||||
Modal,
|
||||
Popover,
|
||||
Scrollspy,
|
||||
Tab,
|
||||
Toast,
|
||||
Tooltip
|
||||
}
|
||||
|
||||
// Add your JS customizations here
|
||||
|
|
|
|||
Loading…
Reference in New Issue