question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Cannot Import Nested Modules

See original GitHub issue

Description

Discovered when working with redux-saga. Cannot import on nested node module. Possibly related to this issue? https://github.com/christianalfoni/webpack-bin/issues/64

Expected behavior

import { take, call, put, fork, race } from 'redux-saga/effects';
// allows me to use take, call, put, fork, race in my code

Actual behavior

import { take, call, put, fork, race } from 'redux-saga/effects';
// Uncaught Error: Cannot find module 'redux-saga/effects' from 'js/sagas/index.js'

However, when I import without nested call, everything is fine:

import { effects } from 'redux-saga';
// calling my methods effects.take, effects.call, etc.

Full project and effected file can be found at js/sagas/index.js

Environment

  1. Brunch: 2.10.9
  2. Node.js: v6.9.4
  3. NPM: 3.10.10
  4. Operating system: OSX El Capitan 10.11.6
  5. Code editor: Visual Studio Code 1.11.1

package.json contents

{
  "name": "udia",
  "version": "0.0.0",
  "description": "Universal Dream, Infinite Awareness",
  "repository": {
    "type": "git",
    "url": "https://github.com/udia-software/udia.git"
  },
  "private": true,
  "license": "CPAL-1.0",
  "scripts": {
    "deploy": "brunch build --production",
    "watch": "brunch watch --stdin",
    "eslint": "eslint js"
  },
  "dependencies": {
    "babel-polyfill": "^6.23.0",
    "phoenix": "file:../deps/phoenix",
    "phoenix_html": "file:../deps/phoenix_html",
    "prop-types": "^15.5.4",
    "react": "^15.5.3",
    "react-dom": "^15.5.3",
    "react-redux": "^5.0.3",
    "react-router": "^4.0.0",
    "react-router-dom": "^4.0.0",
    "redux": "^3.6.0",
    "redux-logger": "^3.0.1",
    "redux-saga": "^0.14.6",
    "semantic-ui-react": "^0.67.2"
  },
  "devDependencies": {
    "auto-reload-brunch": "^2.7.1",
    "babel-brunch": "6.1.1",
    "babel-eslint": "^7.2.1",
    "babel-preset-env": "^1.3.3",
    "babel-preset-react": "^6.23.0",
    "babel-preset-stage-1": "^6.24.1",
    "brunch": "2.10.9",
    "clean-css-brunch": "2.10.0",
    "eslint": "^3.19.0",
    "eslint-config-airbnb": "^14.1.0",
    "eslint-plugin-import": "^2.2.0",
    "eslint-plugin-jsx-a11y": "^4.0.0",
    "eslint-plugin-react": "^6.10.3",
    "hmr-brunch": "^0.1.1",
    "localStorage": "^1.0.3",
    "uglify-js-brunch": "2.10.0"
  }
}

brunch config contents

exports.config = {
  // See http://brunch.io/#documentation for docs.
  files: {
    javascripts: {
      joinTo: 'js/app.js',
    },
    stylesheets: {
      joinTo: 'css/app.css',
    },
    templates: {
      joinTo: 'js/app.js',
    },
  },

  conventions: {
    assets: /^(static)/,
  },

  paths: {
    watched: ['static', 'css', 'js', 'vendor'],
    public: '../priv/static',
  },

  plugins: {
    babel: {
      presets: ['env', 'stage-1', 'react'],
      ignore: [/vendor/],
    },
  },

  modules: {
    autoRequire: {
      'js/app.js': ['js/index'],
    },
  },

  npm: {
    enabled: true,
  },

  // Hot module reloading
  hot: true,
};

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:13 (3 by maintainers)

github_iconTop GitHub Comments

4reactions
shvaikaleshcommented, Aug 4, 2017

Yes, it is in the works: #1664

2reactions
Andaristcommented, May 4, 2017

is brunch es6 modules aware? What types of modules can it consume by default? cjs/umd only?

Read more comments on GitHub >

github_iconTop Results From Across the Web

python can't get nested modules being imported
import will attempt to call the _ _ init _ _.py file within the module. You however do neither have that file, nor...
Read more >
0.13.0 cannot import resources in nested modules when count ...
As a workaround you can remove the countable module (rename file to different extension), then perform the import on the unrelated resource, ...
Read more >
Cannot import nested Python module when writing an add-on
I have tried adding an init file to all of my sub-modules to no avail. The only way I can get it to...
Read more >
Import-Module (Microsoft.PowerShell.Core)
When invoked from another module, Import-Module cmdlet imports the commands in a module, including commands from nested modules, into the calling module's ...
Read more >
Import: Modules and Packages - Python Like You Mean It
Importing a module will execute these statements, rendering the resulting objects available via the imported module. Let's create our own module and import...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found