Skip to content

module finding path is changed in new instance window in 0.10.1 #2167

@ghostoy

Description

@ghostoy

Descriptions

When opening a new instance window, the module finding path used by require is changed. This happens when the opener (parent) window is in a sub-directory. For example, parent window is in public/index.html, and opened (child) window is also in that folder public/new-instance.html. Requiring same module test.js in the root directory is require('../test') for parent window, and require('./test') for child window.
This behavior is different from nw 0.8.x, only happens when new-instance attribute is set to true.
Version Effected: 0.10.1

Steps to Reproduce

  1. Point "main" to a sub-directory file in package.json, for example, public/index.html
  2. Open a new instance window within the same folder, for example, public/new-instance.html
  3. Require a module in parent directory, for example, require('../test')

Expected and Got

  • Expected: successfully required the module
  • Got: module not found

Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions