Skip to content

Commit

Permalink
fix: node-libs-browser being imported on the client (#936)
Browse files Browse the repository at this point in the history
Replace deepcopy with lodash deepclone.
Fixes node-libs-browser being imported and problems with old Nuxt versions.

Co-authored-by: Jan Kollars <jan.kollars@riag-digital.com>
Co-authored-by: Rafał Chłodnicki <rchl2k@gmail.com>

Resolves #907
Resolves #935
  • Loading branch information
janKollars authored Oct 19, 2020
1 parent a5d7844 commit 7490ae9
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 16 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,9 @@
"@intlify/vue-i18n-extensions": "^1.0.1",
"@intlify/vue-i18n-loader": "^1.0.0",
"cookie": "^0.4.0",
"deepcopy": "^2.1.0",
"is-https": "^2.0.0",
"js-cookie": "^2.2.1",
"lodash.clonedeep": "^4.5.0",
"vue-i18n": "^8.18.1"
},
"devDependencies": {
Expand Down
5 changes: 0 additions & 5 deletions src/core/hooks.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,6 @@ export function createExtendRoutesHook (moduleContainer, options) {
}

export function buildHook (moduleContainer, options) {
const nuxtOptions = moduleContainer.options

// Transpile deepcopy dependency that is not sufficiently transpiled for IE11.
nuxtOptions.build.transpile.push(({ isServer, isModern }) => isServer || isModern ? false : 'deepcopy')

if (options.langDir) {
if (!options.locales.length || typeof options.locales[0] === 'string') {
console.error('[' + MODULE_NAME + '] When using "langDir" option, the "locales" option must be a list of objects')
Expand Down
4 changes: 2 additions & 2 deletions src/templates/plugin.main.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import deepcopy from 'deepcopy'
import cloneDeep from 'lodash.clonedeep'
import Vue from 'vue'
import VueI18n from 'vue-i18n'
import { nuxtI18nSeo } from './seo-head'
Expand Down Expand Up @@ -225,7 +225,7 @@ export default async (context) => {
}

// Set instance options
const vueI18nOptions = typeof vueI18n === 'function' ? vueI18n(context) : deepcopy(vueI18n)
const vueI18nOptions = typeof vueI18n === 'function' ? vueI18n(context) : cloneDeep(vueI18n)
vueI18nOptions.componentInstanceCreatedListener = extendVueI18nInstance
app.i18n = new VueI18n(vueI18nOptions)
// Initialize locale and fallbackLocale as vue-i18n defaults those to 'en-US' if falsey
Expand Down
14 changes: 6 additions & 8 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -4538,13 +4538,6 @@ deep-is@~0.1.3:
resolved "https://registry.yarnpkg.com/deep-is/-/deep-is-0.1.3.tgz#b369d6fb5dbc13eecf524f91b070feedc357cf34"
integrity sha1-s2nW+128E+7PUk+RsHD+7cNXzzQ=

deepcopy@^2.1.0:
version "2.1.0"
resolved "https://registry.yarnpkg.com/deepcopy/-/deepcopy-2.1.0.tgz#2deb0dd52d079c2ecb7924b640a7c3abd4db1d6d"
integrity sha512-8cZeTb1ZKC3bdSCP6XOM1IsTczIO73fdqtwa2B0N15eAz7gmyhQo+mc5gnFuulsgN3vIQYmTgbmQVKalH1dKvQ==
dependencies:
type-detect "^4.0.8"

deepmerge@^4.2.2:
version "4.2.2"
resolved "https://registry.yarnpkg.com/deepmerge/-/deepmerge-4.2.2.tgz#44d2ea3679b8f4d4ffba33f03d865fc1e7bf4955"
Expand Down Expand Up @@ -7813,6 +7806,11 @@ lodash._reinterpolate@^3.0.0:
resolved "https://registry.yarnpkg.com/lodash._reinterpolate/-/lodash._reinterpolate-3.0.0.tgz#0ccf2d89166af03b3663c796538b75ac6e114d9d"
integrity sha1-DM8tiRZq8Ds2Y8eWU4t1rG4RTZ0=

lodash.clonedeep@^4.5.0:
version "4.5.0"
resolved "https://registry.yarnpkg.com/lodash.clonedeep/-/lodash.clonedeep-4.5.0.tgz#e23f3f9c4f8fbdde872529c1071857a086e5ccef"
integrity sha1-4j8/nE+Pvd6HJSnBBxhXoIblzO8=

lodash.get@^4.4.2:
version "4.4.2"
resolved "https://registry.yarnpkg.com/lodash.get/-/lodash.get-4.4.2.tgz#2d177f652fa31e939b4438d5341499dfa3825e99"
Expand Down Expand Up @@ -11812,7 +11810,7 @@ type-check@~0.3.2:
dependencies:
prelude-ls "~1.1.2"

type-detect@4.0.8, type-detect@^4.0.8:
type-detect@4.0.8:
version "4.0.8"
resolved "https://registry.yarnpkg.com/type-detect/-/type-detect-4.0.8.tgz#7646fb5f18871cfbb7749e69bd39a6388eb7450c"
integrity sha512-0fr/mIH1dlO+x7TlcMy+bIDqKPsw/70tVyeHW787goQjhmqaZe10uwLujubK9q9Lg6Fiho1KUKDYz0Z7k7g5/g==
Expand Down

0 comments on commit 7490ae9

Please sign in to comment.