Skip to content

Commit

Permalink
feat(nuxt module): alias esm/ and es/ to src/ for Nuxt prod mode (
Browse files Browse the repository at this point in the history
#3423)

To help prevent duplicate code imports if users might be cherry-picking modules as well
  • Loading branch information
tmorehouse authored and jacobmllr95 committed May 31, 2019
1 parent 8d7c193 commit ae2040b
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion nuxt/index.js
Expand Up @@ -91,7 +91,13 @@ module.exports = function nuxtBootstrapVue(moduleOptions = {}) {
if (!config.resolve.alias) {
config.resolve.alias = {}
}
config.resolve.alias['bootstrap-vue$'] = require.resolve(srcIndex)
const index = require.resolve(srcIndex)
const srcDir = index.replace(/index\.js$/, '')
config.resolve.alias['bootstrap-vue$'] = index
// If users are cherry-picking modules from esm/ or es/ (legacy),
// alias to src/ to prevent duplicate code imports
config.resolve.alias['bootstrap-vue/esm/'] = srcDir
config.resolve.alias['bootstrap-vue/es/'] = srcDir
})
}

Expand Down

0 comments on commit ae2040b

Please sign in to comment.