Skip to content

Commit

Permalink
updated: rollup plugins
Browse files Browse the repository at this point in the history
  • Loading branch information
GianlucaGuarini committed May 4, 2021
1 parent ae3a3fb commit d236805
Show file tree
Hide file tree
Showing 4 changed files with 217 additions and 112 deletions.
17 changes: 8 additions & 9 deletions build/rollup.browser.config.js
Original file line number Diff line number Diff line change
@@ -1,27 +1,29 @@
import alias from 'rollup-plugin-alias'
import alias from '@rollup/plugin-alias'
import builtins from 'rollup-plugin-node-builtins'
import commonjs from 'rollup-plugin-commonjs'
import commonjs from '@rollup/plugin-commonjs'
import defaultConfig from './rollup.config'
import json from '@rollup/plugin-json'
import nodeResolve from '@rollup/plugin-node-resolve'
import { resolve } from 'path'

const sourcemapPath = resolve('./node_modules/source-map/dist/source-map')
const ignredModules = ['fs', 'path']
const ignoredModules = ['fs', 'path']

export default {
...defaultConfig,
output: {
name: 'compiler',
file: './dist/compiler.js',
format: 'umd',
globals: ignredModules.reduce((acc, dep) => ({
// small hack to provide the global variable to the bundle
intro: 'var global = window;',
globals: ignoredModules.reduce((acc, dep) => ({
[dep]: dep,
...acc
}), {}),
...defaultConfig.output
},
external: ignredModules,
external: ignoredModules,
plugins: [
builtins(),
json(),
Expand All @@ -33,10 +35,7 @@ export default {
}),
commonjs({
include: 'node_modules/**',
namedExports: {
[sourcemapPath]: ['SourceMapGenerator', 'SourceMapConsumer']
},
ignoreGlobal: true
})
]
}
}
4 changes: 2 additions & 2 deletions build/rollup.node.config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import commonjs from 'rollup-plugin-commonjs'
import commonjs from '@rollup/plugin-commonjs'
import defaultConfig from './rollup.config'
import json from '@rollup/plugin-json'
import nodeResolve from '@rollup/plugin-node-resolve'
Expand All @@ -22,4 +22,4 @@ export default {
format: 'esm',
...defaultConfig.output
}]
}
}
Loading

0 comments on commit d236805

Please sign in to comment.