Skip to content

Commit

Permalink
Turn off lodash replacement in cjs
Browse files Browse the repository at this point in the history
  • Loading branch information
jaredpalmer committed May 16, 2019
1 parent f01da2e commit af526a5
Show file tree
Hide file tree
Showing 3 changed files with 477 additions and 465 deletions.
28 changes: 14 additions & 14 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,30 +29,30 @@
"templates"
],
"dependencies": {
"@babel/core": "^7.2.2",
"@babel/core": "^7.4.4",
"@jaredpalmer/rollup-plugin-preserve-shebang": "^0.1.7",
"ansi-escapes": "^3.1.0",
"ansi-escapes": "^3.2.0",
"asyncro": "^3.0.0",
"babel-plugin-annotate-pure-calls": "^0.4.0",
"babel-plugin-dev-expression": "^0.2.1",
"babel-plugin-transform-rename-import": "^2.3.0",
"camelcase": "^5.0.0",
"chalk": "^2.4.2",
"cross-env": "5.0.5",
"cross-env": "5.2.0",
"enquirer": "^2.3.0",
"execa": "^1.0.0",
"fs-extra": "^7.0.1",
"jest": "^24.7.1",
"jest-watch-typeahead": "^0.3.0",
"fs-extra": "^8.0.1",
"jest": "^24.8.0",
"jest-watch-typeahead": "^0.3.1",
"jpjs": "^1.2.1",
"mkdirp": "^0.5.1",
"ora": "^3.0.0",
"ora": "^3.4.0",
"progress-estimator": "^0.2.2",
"rollup": "^1.10.1",
"rollup": "^1.12.0",
"rollup-plugin-babel": "^4.3.2",
"rollup-plugin-commonjs": "^9.3.4",
"rollup-plugin-commonjs": "^10.0.0",
"rollup-plugin-json": "^4.0.0",
"rollup-plugin-node-resolve": "^4.2.3",
"rollup-plugin-node-resolve": "^5.0.0",
"rollup-plugin-replace": "^2.2.0",
"rollup-plugin-size-snapshot": "^0.8.0",
"rollup-plugin-sourcemaps": "^0.4.2",
Expand All @@ -68,15 +68,15 @@
"@types/ansi-escapes": "^4.0.0",
"@types/camelcase": "^5.2.0",
"@types/execa": "^0.9.0",
"@types/fs-extra": "^5.0.5",
"@types/fs-extra": "^7.0.0",
"@types/mkdirp": "^0.5.2",
"@types/ms": "^0.7.30",
"@types/node": "^11.13.8",
"@types/node": "^12.0.2",
"@types/ora": "^3.2.0",
"@types/rollup-plugin-json": "^3.0.2",
"@types/rollup-plugin-sourcemaps": "^0.4.2",
"husky": "^2.1.0",
"prettier": "^1.17.0",
"husky": "^2.3.0",
"prettier": "^1.17.1",
"pretty-quick": "^1.10.0",
"ps-tree": "^1.2.0",
"shelljs": "^0.8.3",
Expand Down
15 changes: 9 additions & 6 deletions src/createRollupConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,18 @@ import shebangPlugin from '@jaredpalmer/rollup-plugin-preserve-shebang';

const replacements = [{ original: 'lodash', replacement: 'lodash-es' }];

const babelOptions = {
const babelOptions = (format: 'cjs' | 'es' | 'umd') => ({
exclude: /node_modules/,
extensions: [...DEFAULT_EXTENSIONS, 'ts', 'tsx'],
plugins: [
'annotate-pure-calls',
'dev-expression',
['transform-rename-import', { replacements }],
],
};
require.resolve('babel-plugin-annotate-pure-calls'),
require.resolve('babel-plugin-dev-expression'),
format !== 'cjs' && [
require.resolve('babel-plugin-transform-rename-import'),
{ replacements },
],
].filter(Boolean),
});

export function createRollupConfig(
format: 'cjs' | 'umd' | 'es',
Expand Down
Loading

0 comments on commit af526a5

Please sign in to comment.