mirror of
https://github.com/danog/sass-site.git
synced 2024-11-27 04:24:50 +01:00
36 lines
849 B
JavaScript
36 lines
849 B
JavaScript
const { babel } = require('@rollup/plugin-babel');
|
|
const commonjs = require('@rollup/plugin-commonjs');
|
|
const inject = require('@rollup/plugin-inject');
|
|
const { nodeResolve } = require('@rollup/plugin-node-resolve');
|
|
const terser = require('@rollup/plugin-terser');
|
|
const { defineConfig } = require('rollup');
|
|
|
|
const prod = process.env.BABEL_ENV === 'production';
|
|
|
|
const plugins = [
|
|
nodeResolve({
|
|
extensions: ['.mjs', '.js', '.json', '.node', '.ts'],
|
|
browser: true,
|
|
}),
|
|
commonjs(),
|
|
babel({ extensions: ['.js', '.ts'], babelHelpers: 'bundled' }),
|
|
inject({
|
|
$: 'jquery',
|
|
jQuery: 'jquery',
|
|
}),
|
|
];
|
|
|
|
if (prod) {
|
|
plugins.push(terser());
|
|
}
|
|
|
|
module.exports = defineConfig({
|
|
input: 'source/assets/js/sass.ts',
|
|
output: {
|
|
file: 'source/assets/dist/js/sass.js',
|
|
format: 'iife',
|
|
sourcemap: !prod,
|
|
},
|
|
plugins,
|
|
});
|