2023-06-19 23:55:26 +02:00
|
|
|
const {babel} = require('@rollup/plugin-babel');
|
2023-02-26 02:07:51 +01:00
|
|
|
const commonjs = require('@rollup/plugin-commonjs');
|
|
|
|
const inject = require('@rollup/plugin-inject');
|
2023-06-19 23:55:26 +02:00
|
|
|
const {nodeResolve} = require('@rollup/plugin-node-resolve');
|
2023-02-26 02:07:51 +01:00
|
|
|
const terser = require('@rollup/plugin-terser');
|
2023-06-19 23:55:26 +02:00
|
|
|
const {defineConfig} = require('rollup');
|
2023-01-06 23:35:10 +01:00
|
|
|
|
2023-01-09 20:10:02 +01:00
|
|
|
const prod = process.env.BABEL_ENV === 'production';
|
2023-01-06 23:35:10 +01:00
|
|
|
|
|
|
|
const plugins = [
|
2023-01-09 20:48:04 +01:00
|
|
|
nodeResolve({
|
|
|
|
extensions: ['.mjs', '.js', '.json', '.node', '.ts'],
|
|
|
|
browser: true,
|
|
|
|
}),
|
2023-01-06 23:35:10 +01:00
|
|
|
commonjs(),
|
2023-06-19 23:55:26 +02:00
|
|
|
babel({extensions: ['.js', '.ts'], babelHelpers: 'bundled'}),
|
2023-01-06 23:35:10 +01:00
|
|
|
inject({
|
2023-01-09 20:10:02 +01:00
|
|
|
$: 'jquery',
|
|
|
|
jQuery: 'jquery',
|
2023-01-06 23:35:10 +01:00
|
|
|
}),
|
|
|
|
];
|
|
|
|
|
|
|
|
if (prod) {
|
|
|
|
plugins.push(terser());
|
|
|
|
}
|
|
|
|
|
2023-06-02 15:24:32 +02:00
|
|
|
module.exports = defineConfig([
|
|
|
|
{
|
|
|
|
input: 'source/assets/js/sass.ts',
|
|
|
|
output: {
|
|
|
|
file: 'source/assets/dist/js/sass.js',
|
|
|
|
format: 'iife',
|
|
|
|
sourcemap: !prod,
|
|
|
|
},
|
|
|
|
plugins,
|
2023-01-06 23:35:10 +01:00
|
|
|
},
|
2023-06-02 15:24:32 +02:00
|
|
|
{
|
2023-06-09 18:22:57 +02:00
|
|
|
input: 'source/assets/js/playground.ts',
|
2023-06-02 15:24:32 +02:00
|
|
|
output: {
|
|
|
|
file: 'source/assets/dist/js/playground.js',
|
|
|
|
format: 'iife',
|
|
|
|
sourcemap: !prod,
|
|
|
|
},
|
|
|
|
plugins,
|
2023-06-02 16:53:32 +02:00
|
|
|
},
|
2023-06-02 15:24:32 +02:00
|
|
|
]);
|