Skip to content
This repository has been archived by the owner on May 24, 2024. It is now read-only.

Commit

Permalink
Use new webpack-config-terra package (#1280)
Browse files Browse the repository at this point in the history
* Use new webpack config package

* Update webpack.config.js

Co-authored-by: Emily Rohrbough  <[email protected]>

Co-authored-by: Emily Rohrbough  <[email protected]>
  • Loading branch information
mjhenkes and emilyrohrbough authored Oct 14, 2020
1 parent 4fa0427 commit 182452d
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 3 deletions.
2 changes: 1 addition & 1 deletion babel.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module.exports = (api) => {
api.assertVersion('^7.4.4');

const presets = [
'@babel/preset-env',
['@babel/preset-env', { useBuiltIns: 'entry', corejs: { version: 3.6, proposals: true } }],
'@babel/preset-react',
];

Expand Down
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@
"@babel/preset-react": "^7.0.0",
"@cerner/browserslist-config-terra": "^3.1.0",
"@cerner/eslint-config-terra": "^4.0.0",
"@cerner/webpack-config-terra": "^1.0.0-alpha.0",
"babel-jest": "^24.8.0",
"check-installed-dependencies": "^1.0.0",
"core-js": "^3.1.3",
Expand Down Expand Up @@ -137,6 +138,7 @@
"webpack": "^4.30.0",
"webpack-cli": "^3.3.2",
"webpack-dev-server": "^3.3.1",
"webpack-merge": "^5.1.4",
"xfc": "^1.2.1"
}
}
49 changes: 47 additions & 2 deletions webpack.config.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,48 @@
const terraDevSiteWebpackConfig = require('terra-dev-site/config/webpack/webpack.config');
/* eslint-disable import/no-extraneous-dependencies */
const { merge } = require('webpack-merge');
const path = require('path');
const {
TerraDevSite,
TerraDevSiteEntrypoints,
DirectorySwitcherPlugin,
LocalPackageAliasPlugin,
} = require('terra-dev-site');

module.exports = terraDevSiteWebpackConfig;
const WebpackConfigTerra = require('@cerner/webpack-config-terra');
/**
* Generates the file representing app name configuration.
*/
const devSiteConfig = (env = {}, argv = { p: false }) => {
const production = argv.p;
const processPath = process.cwd();

return {
entry: TerraDevSiteEntrypoints,
plugins: [
new TerraDevSite({ env }),
],
resolve: {
plugins: [
new DirectorySwitcherPlugin({
shouldSwitch: !production,
rootDirectories: [
processPath,
path.resolve(processPath, 'packages', '*'),
],
}),
new LocalPackageAliasPlugin({
rootDirectories: [
processPath,
path.resolve(processPath, 'packages', '*'),
],
}),
],
},
};
};

const webpackConfig = (env, argv) => (
merge(WebpackConfigTerra(env, argv), devSiteConfig(env, argv))
);

module.exports = webpackConfig;

0 comments on commit 182452d

Please sign in to comment.