Skip to content

Commit

Permalink
fix for svgloader adding duplicate config (#435)
Browse files Browse the repository at this point in the history
  • Loading branch information
dylankelly committed Jul 16, 2019
1 parent dfa4cf1 commit c7a3e2a
Show file tree
Hide file tree
Showing 3 changed files with 240 additions and 1,014 deletions.
27 changes: 15 additions & 12 deletions packages/ripple-nuxt-ui/lib/module.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const path = require('path')
const appDir = path.dirname(require.main.filename)
const appDir = require('app-root-path')

const resolve = path.resolve

Expand All @@ -25,16 +25,19 @@ module.exports = function nuxtRipple (moduleOptions) {
]
}
// Add svg-sprite-loader to create svg sprite
config.module.rules.push({
test: /\.svg$/,
include: [
resolve(__dirname, rippleIconPath),
resolve(__dirname, `${appDir}/assets/ripple-icon/`)
],
use: [
'svg-sprite-loader',
'svgo-loader'
]
})
const svgLoader = config.module.rules.find((rule) => rule.use && rule.use.find(r => r === 'svgo-loader'))
if (!svgLoader) {
config.module.rules.push({
test: /\.svg$/,
include: [
resolve(__dirname, rippleIconPath),
resolve(__dirname, `${appDir}/assets/ripple-icon/`)
],
use: [
'svg-sprite-loader',
'svgo-loader'
]
})
}
})
}
1 change: 1 addition & 0 deletions packages/ripple-nuxt-ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
],
"main": "lib/module.js",
"dependencies": {
"app-root-path": "^2.2.1",
"@dpc-sdp/ripple-global": "1.0.0-beta.7",
"@dpc-sdp/ripple-icon": "1.0.0-beta.7",
"svg-sprite-loader": "^3.7.3",
Expand Down
Loading

0 comments on commit c7a3e2a

Please sign in to comment.