Skip to content

Commit

Permalink
RC #251 - Adding custom webpack config to /.storybook/main.js to work…
Browse files Browse the repository at this point in the history
…-around an issue with ESM libraries
  • Loading branch information
dleadbetter committed Feb 5, 2024
1 parent 70573d5 commit 33c6665
Show file tree
Hide file tree
Showing 6 changed files with 43 additions and 310 deletions.
5 changes: 2 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,8 @@
"packages/*"
],
"scripts": {
"build-semantic": "yarn --cwd packages/semantic-ui build",
"build-shared": "yarn --cwd packages/shared build",
"build-storybook": "yarn build-shared && yarn build-semantic && yarn --cwd packages/storybook build",
"build-all": "node --experimental-json-modules ./scripts/build.js",
"build-storybook": "yarn build-all && yarn --cwd packages/storybook build",
"flow": "flow",
"storybook": "yarn --cwd packages/storybook storybook",
"test": "jest",
Expand Down
6 changes: 1 addition & 5 deletions packages/core-data/webpack.config.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
const { configure } = require('@performant-software/webpack-config');

module.exports = configure(__dirname, {
resolve: {
conditionNames: ['import', 'browser', 'node', 'default']
}
});
module.exports = configure(__dirname);
3 changes: 1 addition & 2 deletions packages/geospatial/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ module.exports = configure(__dirname, {
__dirname,
'../../node_modules/maplibre-gl/dist/maplibre-gl.css'
)
},
conditionNames: ['import', 'browser', 'node', 'default']
}
}
});
6 changes: 3 additions & 3 deletions packages/storybook/.storybook/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@ const config = {
options: {}
},
async webpackFinal(config) {
config.resolve = {
const resolve = {
...config.resolve,
conditionNames: ['import', 'browser', 'default']
};
}

return config;
return _.extend(config, { resolve });
},
babel: (options) => {
// Remove the override applied from @storybook/react
Expand Down
23 changes: 23 additions & 0 deletions scripts/build.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
// @flow

import { execSync } from 'child_process';
import fs from 'fs';
import _ from 'underscore';

/**
* Runs the process.
*/
const run = () => {
const { packages } = JSON.parse(fs.readFileSync('./react-components.json'));

_.each(packages, (directory) => {
console.log('');
console.log(`Building ${directory}...`);
console.log('');
console.log('');

execSync(`yarn --cwd ${directory} build`, { stdio: 'inherit' });
});
};

run();
Loading

0 comments on commit 33c6665

Please sign in to comment.