UNPKG

nuxt-browser-console

Version:

show server-side & clinet-side logs/errors/warnings inside browser console

39 lines (33 loc) 1.06 kB
// module.js const { resolve, join } = require('path') const { readdirSync } = require('fs') export default function (moduleOptions) { // get all options for the module const options = { ...moduleOptions, ...this.options.browserConsole } const { namespace = 'console' } = options // add all of the initial plugins const pluginsToSync = ['plugins/index.server.js', 'plugins/index.client.js'] for (const pathString of pluginsToSync) { this.addPlugin({ src: resolve(__dirname, pathString), fileName: join(namespace, pathString), options }) } // sync all of the files and folders to relevant places in the nuxt build dir (.nuxt/) const foldersToSync = ['plugins/helpers'] for (const pathString of foldersToSync) { const path = resolve(__dirname, pathString) for (const file of readdirSync(path)) { this.addTemplate({ src: resolve(path, file), fileName: join(namespace, pathString, file), options }) } } } module.exports.meta = require('../package.json')