UNPKG

932 BJavaScriptView Raw
1import path from 'path';
2
3import json from 'rollup-plugin-json';
4import babel from 'rollup-plugin-babel';
5import resolve from 'rollup-plugin-node-resolve';
6
7export default {
8 dest: 'dist/index.js',
9 entry: 'src/packages/cli/commands/index.js',
10 format: 'cjs',
11 banner: (
12 'require(\'source-map-support\').install({\n'
13 + ' environment: \'node\'\n'
14 + '});\n'
15 ),
16 onwarn: ({ code, message }) => {
17 if (code === 'UNUSED_EXTERNAL_IMPORT') {
18 return;
19 }
20 // eslint-disable-next-line no-console
21 console.warn(message);
22 },
23 plugins: [
24 json(),
25 babel(),
26 resolve()
27 ],
28 external: id => !(
29 id.startsWith('.')
30 || id.startsWith('/') // Absolute path on Unix
31 || /^[A-Z]:[\\/]/.test(id) // Absolute path on Windows
32 || id.startsWith('src')
33 || id.startsWith(path.join(__dirname, 'src'))
34 || id === 'babelHelpers'
35 || id === '\u0000babelHelpers'
36 ),
37 sourceMap: true
38};