mirror of
https://github.com/tenrok/BBob.git
synced 2026-06-17 19:21:20 +03:00
chore: update build system and dependencies (#155)
* chore: fix swc + rollup transform * chore: fix pkg-task args parsing * chore: update lerna, rollup and swc to build proper es6 files * chore: fix swc build for es targets * ci: nodes matrix to newest versions * ci: rollup to mjs, swc to json * ci: add canary publish * ci: no git tag for canary * ci: no private publish for canary * ci: remove --canary from publish-canary * fix: remove gitHead from package.json * fix: tests setup * fix: bbob plugin helper imports * fix: plugin helper build priority and circular deps * fix: add nx for parallel build * fix: npm ci * fix: code ql * fix: remove exports directive * fix: rollup build * fix: vue2 test and minify * fix: bundle size limits * feat: bundlephobia pr review * feat: bundlephobia more popular action * feat: publish branch to npm * fix: secret NPM token * fix: bundlephobia version * fix: remove bundlephobia checker * fix: npm publish in PR * chore: release 2.8.3 * chore: fix test runs on CI, removed 14.x version * fix: sync package-lock * fix: remove lock files in sub packages * fix: bundlesize > bundlesize2 * fix: update lock files * fix: lock file in vue2-example
This commit is contained in:
@@ -0,0 +1,64 @@
|
||||
import { defineConfig } from 'rollup';
|
||||
|
||||
import resolve from '@rollup/plugin-node-resolve'
|
||||
import replace from '@rollup/plugin-replace'
|
||||
import commonjs from '@rollup/plugin-commonjs'
|
||||
import { minify } from 'rollup-plugin-swc3'
|
||||
|
||||
import { createRequire } from 'node:module';
|
||||
|
||||
const require = createRequire(import.meta.url);
|
||||
// eslint-disable-next-line import/no-dynamic-require
|
||||
const pkg = require(`${process.cwd()}/package.json`);
|
||||
const { NODE_ENV } = process.env;
|
||||
|
||||
const baseConfig = {
|
||||
input: 'es/index.js',
|
||||
external: ['react', 'vue', 'prop-types'],
|
||||
output: {
|
||||
file: pkg.browser,
|
||||
name: pkg.browserName,
|
||||
format: 'umd',
|
||||
exports: 'named',
|
||||
globals: {
|
||||
react: 'React',
|
||||
vue: 'Vue',
|
||||
'prop-types': 'PropTypes',
|
||||
},
|
||||
},
|
||||
plugins: [
|
||||
resolve(),
|
||||
commonjs({
|
||||
transformMixedEsModules: true,
|
||||
requireReturnsDefault: true,
|
||||
}),
|
||||
replace({
|
||||
preventAssignment: true,
|
||||
'process.env.NODE_ENV': JSON.stringify(NODE_ENV),
|
||||
}),
|
||||
],
|
||||
};
|
||||
|
||||
// only for dist
|
||||
export default defineConfig([
|
||||
baseConfig,
|
||||
{
|
||||
...baseConfig,
|
||||
output: {
|
||||
...baseConfig.output,
|
||||
file: pkg.browser.replace('.js', '.min.js'),
|
||||
},
|
||||
plugins: [
|
||||
...baseConfig.plugins,
|
||||
minify({
|
||||
compress: {
|
||||
pure_getters: true,
|
||||
unsafe: true,
|
||||
unsafe_comps: true,
|
||||
inline: true,
|
||||
keep_classnames: true,
|
||||
},
|
||||
}),
|
||||
],
|
||||
},
|
||||
]);
|
||||
Reference in New Issue
Block a user