Skip to content

Commit

Permalink
fix: avoid warning in standalone build
Browse files Browse the repository at this point in the history
  • Loading branch information
mercs600 committed Jan 12, 2021
1 parent 2ec8663 commit 19a28c2
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
3 changes: 3 additions & 0 deletions lib/module.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { resolve, join } from 'path'
import webpack from 'webpack'
import defu from 'defu'
import _options from './options'

Expand Down Expand Up @@ -84,6 +85,8 @@ function Typo3(options) {

this.extendBuild((config, { isDev, isClient }) => {
config.resolve.alias['~typo3'] = resolve(__dirname, './templates')
// avoid warning about about consola dependency in case of standalone build
config.plugins.push(new webpack.ContextReplacementPlugin(/consola/))
})
}

Expand Down
6 changes: 3 additions & 3 deletions lib/templates/lib/api.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import consola from 'consola'
import logger from '~typo3/lib/logger'
export default class API {
/**
* typo3 API Constructor
Expand Down Expand Up @@ -27,8 +27,8 @@ export default class API {
return this.$http
.get(`${params.path}/${this.options.endpoints.initialData}`)
.catch(error => {
consola.info('Check your API host: ', error.config.url)
consola.error(new Error(error))
logger.warn(`cant get the initial config ${this.options.baseURL}`)
logger.error(new Error(error))
throw error
})
}
Expand Down
3 changes: 3 additions & 0 deletions lib/templates/lib/logger.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import consola from 'consola'
const logger = consola.withScope('nuxt:typo3')
export default logger

0 comments on commit 19a28c2

Please sign in to comment.