Nuxt/scripts/rollup/rollup.config.js
Tatsuyuki Ishi c954ad4763 feat(packaging): rollup build improvements (#3402)
* Add missing devDependencies

This avoids relying on transitively installed dependencies.

* rollup: avoid bundling any NPM module

This is a hack relying on how rollup-plugin-node-resolve filters the path, but it works as intended.
2018-06-01 15:59:10 +04:30

24 lines
562 B
JavaScript

import nodeResolve from 'rollup-plugin-node-resolve'
import json from 'rollup-plugin-json'
import commonjs from 'rollup-plugin-commonjs'
import defaultsDeep from 'lodash/defaultsDeep'
export default ({ name, input, plugins = [], options }) => defaultsDeep({}, options, {
input,
output: {
file: `dist/${name}.js`,
format: 'cjs',
sourcemap: true
},
plugins: [
nodeResolve({
modulesOnly: true,
preferBuiltins: true,
only: ['./'],
extensions: ['.mjs', '.js']
}),
commonjs(),
json()
].concat(plugins)
})