Skip to content

Commit

Permalink
chore(Portal): fix src vs build usage during development (#1638)
Browse files Browse the repository at this point in the history
It could happen that the some `build` styles where used alongside with styles from `src` when run in dev, if it existed. This PR ensures we do not get this anymore.
  • Loading branch information
tujoworker authored Oct 14, 2022
1 parent 9e51565 commit 4b6dafa
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
4 changes: 2 additions & 2 deletions packages/dnb-design-system-portal/gatsby-node.js
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ async function createRedirects({ graphql, actions }) {
})
}

exports.onCreateWebpackConfig = ({ actions, plugins }) => {
exports.onCreateWebpackConfig = ({ stage, actions, plugins }) => {
const config = {
resolve: {
alias: {
Expand All @@ -209,7 +209,7 @@ exports.onCreateWebpackConfig = ({ actions, plugins }) => {
],
}

if (isCI && prebuildExists) {
if (isCI && prebuildExists && stage === 'build-javascript') {
config.plugins.push(
plugins.normalModuleReplacement(/@dnb\/eufemia\/src/, (resource) => {
resource.request = resource.request.replace(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,11 @@ import { isCI } from 'repo-utils'
* Import Eufemia Styles
* Use require because Webpack does not import styles after we change /src to /build
*/
if (isCI && process.env.PREBUILD_EXISTS) {
if (
isCI &&
process.env.PREBUILD_EXISTS &&
process.env.NODE_ENV === 'production'
) {
require('@dnb/eufemia/build/style/dnb-ui-extensions.min.css')
require('@dnb/eufemia/build/style/dnb-ui-core.min.css')
require('@dnb/eufemia/build/style/dnb-ui-components.min.css')
Expand Down

0 comments on commit 4b6dafa

Please sign in to comment.