forked from vrk-kpa/suomifi-ui-components
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtsdx.config.js
36 lines (35 loc) · 1.04 KB
/
tsdx.config.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
const postcss = require('rollup-plugin-postcss');
const autoprefixer = require('autoprefixer');
const cssnano = require('cssnano');
const cssImport = require('postcss-import');
const typescript = require('@wessberg/rollup-plugin-ts');
module.exports = {
rollup(config, options) {
config.plugins = config.plugins.map((plugin) => {
if (plugin && plugin.name === 'rpt2') {
return typescript({
transpiler: 'babel',
include: ['**/*.ts', '**/*.tsx'],
transpileOnly: options.transpileOnly || !options.writeMeta,
});
}
return plugin;
});
config.plugins.push(
postcss({
extensions: ['.css', '.scss'],
plugins: [
cssImport(),
autoprefixer(),
cssnano({
preset: ['default', { normalizeWhitespace: false }],
}),
],
inject: false,
// only write out CSS for the first bundle (avoids pointless extra files):
extract: !!options.writeMeta && 'main.css',
}),
);
return config;
},
};