Skip to content

require('../') statement in schemas.js causing bundler issues. #1513

@radicand

Description

@radicand

Context

  • node version: 10.2.1
  • joi version: 13.3.0
  • environment (node, browser): node
  • used with (hapi, standalone, ...): hapi
  • any other relevant information: bundling with Fuse-Box

What are you trying to achieve or the steps to reproduce ?

I'm attempting to create a server-side (nodejs) application bundled with the Fuse-Box bundler. My bundle is created properly, however when I run it, I get issues resulting from this line: https://github.com/hapijs/joi/blob/master/lib/schemas.js#L5 . It seems the backward reference here is something the bundler has trouble figuring out. I've edited my local copy of Joi to change the require from:

const Joi = require('../');

to

const Joi = require('./index');

Everything works properly now. Before you close this as bundler related and not Joi related, my question is: can this be changed, and if not, what is the significance in the way the current require line works that would cause issues with changing to requiring the file explicitly?

Metadata

Metadata

Assignees

Labels

featureNew functionality or improvement

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions