Skip to content

Commit

Permalink
fix umd package build
Browse files Browse the repository at this point in the history
  • Loading branch information
awinogradov committed Dec 14, 2017
1 parent 63aa56d commit 8b3e3f0
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 12 deletions.
21 changes: 15 additions & 6 deletions config/rollup.config.preact.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import replace from 'rollup-plugin-replace';
import { config, output } from './rollup.config.common';

export default [{
Expand All @@ -13,11 +14,19 @@ export default [{
proptypes : 'PropTypes'
},
file : 'umd/index.preact.js'
}].map(output => ({
...config,
input : 'src/presets/Preact.js',
external : ['preact', 'proptypes'],
output
}));
}].map(output => {
const res = {
...config,
input : 'src/presets/Preact.js',
external : ['preact', 'proptypes'],
output
};

output.format === 'umd' && res.plugins.push(replace({
'process.env.BEM_NAMING' : 0
}));

return res;
});


21 changes: 15 additions & 6 deletions config/rollup.config.react.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import replace from 'rollup-plugin-replace';
import { config, output } from './rollup.config.common';

export default [{
Expand All @@ -13,9 +14,17 @@ export default [{
'prop-types' : 'PropTypes'
},
file : 'umd/index.react.js'
}].map(output => ({
...config,
input : 'src/presets/React.js',
external : ['react', 'prop-types'],
output
}));
}].map(output => {
const res = {
...config,
input : 'src/presets/React.js',
external : ['react', 'prop-types'],
output
};

output.format === 'umd' && res.plugins.push(replace({
'process.env.BEM_NAMING' : 0
}));

return res;
});
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@
"rollup-plugin-babel": "^3.0.2",
"rollup-plugin-commonjs": "^8.2.6",
"rollup-plugin-node-resolve": "^3.0.0",
"rollup-plugin-replace": "^2.0.0",
"uglify-js": "^2.7.5"
},
"peerDependencies": {
Expand Down

0 comments on commit 8b3e3f0

Please sign in to comment.