-
-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(build): split rollup configs for main & module
Split rollup config into separate files so the babel plugin `add-module-exports` can be excluded for the .mjs output.
- Loading branch information
citycide
committed
Jul 25, 2017
1 parent
9befc5d
commit e1d57c3
Showing
3 changed files
with
65 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,7 @@ | ||
import babel from 'rollup-plugin-babel' | ||
import mainConfig from './rollup.config.main' | ||
import moduleConfig from './rollup.config.module' | ||
|
||
const pkg = require('./package.json') | ||
const external = Object.keys(pkg.dependencies) | ||
.concat(['fs', 'path', 'sql.js']) | ||
|
||
export default { | ||
entry: 'src/index.js', | ||
external, | ||
plugins: [ | ||
babel({ | ||
babelrc: false, | ||
presets: [['env', { | ||
loose: true, | ||
modules: false, | ||
targets: { node: "4.7.0" } | ||
}], 'stage-0'], | ||
plugins: [ | ||
'external-helpers', | ||
'add-module-exports' | ||
], | ||
runtimeHelpers: false, | ||
exclude: 'node_modules/**' | ||
}) | ||
], | ||
targets: [{ | ||
dest: pkg.main, | ||
format: 'cjs' | ||
}, { | ||
dest: pkg.module, | ||
format: 'es' | ||
}] | ||
} | ||
export default [ | ||
mainConfig, | ||
moduleConfig | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import babel from 'rollup-plugin-babel' | ||
|
||
const pkg = require('./package.json') | ||
const external = Object.keys(pkg.dependencies) | ||
.concat(['fs', 'path', 'sql.js']) | ||
|
||
export default { | ||
entry: 'src/index.js', | ||
external, | ||
plugins: [ | ||
babel({ | ||
babelrc: false, | ||
presets: [['env', { | ||
loose: true, | ||
modules: false, | ||
targets: { node: '4.7.0' } | ||
}], 'stage-0'], | ||
plugins: [ | ||
'external-helpers', | ||
'add-module-exports' | ||
], | ||
runtimeHelpers: false, | ||
exclude: 'node_modules/**' | ||
}) | ||
], | ||
targets: [{ | ||
dest: pkg.main, | ||
format: 'cjs' | ||
}] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import babel from 'rollup-plugin-babel' | ||
|
||
const pkg = require('./package.json') | ||
const external = Object.keys(pkg.dependencies) | ||
.concat(['fs', 'path', 'sql.js']) | ||
|
||
export default { | ||
entry: 'src/index.js', | ||
external, | ||
plugins: [ | ||
babel({ | ||
babelrc: false, | ||
presets: [['env', { | ||
loose: true, | ||
modules: false, | ||
targets: { node: '4.7.0' } | ||
}], 'stage-0'], | ||
plugins: [ | ||
'external-helpers' | ||
], | ||
runtimeHelpers: false, | ||
exclude: 'node_modules/**' | ||
}) | ||
], | ||
targets: [{ | ||
dest: pkg.module, | ||
format: 'es' | ||
}] | ||
} |