Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Relative Path Resolution #55

Closed
miffels opened this issue Jan 22, 2013 · 2 comments
Closed

Relative Path Resolution #55

miffels opened this issue Jan 22, 2013 · 2 comments
Labels

Comments

@miffels
Copy link

miffels commented Jan 22, 2013

Hi sokra,

when I try to build the following setup

project root
|__ lib
|    |__ lib.js
|__ src
|    |__ main.js
|__ build.js

with webpack 0.8.2, where lib.js is some arbitrary library and main.js is as simple as

// main.js
'use strict';

/*global require:true */
require = require('enhanced-require')(module, {
    recursive: true
});

var Lib = require('../lib/lib.js');

then node build (i.e. basically a clone of your build script) would throw the following error:

ERROR: Cannot find module '../lib/lib.js'
 Error: Error: Module "jshint" not found in context "<project root>\src"
  Error: <project root>\node_modules\webpack\buildin\jshint-webpack-web-loader is not a directory
 @ <project root>\src\main.js (line 8, column 14)

This sample works if lib.js is moved to src and the import in main.js is changed accordingly. By the way, it does not matter if require or enhanced-require is used.

Best regards,
miffels

@sokra
Copy link
Member

sokra commented Jan 22, 2013

check the build script... You applied a post loader for any file in lib (postLoaders). You want to post load the files with jshint-loader, but it's not npm installed.

Try npm install jshint-loader if you want to post load the files.

Or remove the postLoader from you config.

@miffels
Copy link
Author

miffels commented Jan 22, 2013

Gosh, of course:

    ...
    preLoaders": [
        {
            "test": "\\.js$",
            "include": "lib",
            "exclude": [
                "jam",
                "web_modules",
                "node_modules"
            ],
            "loader": "jshint"
        }
    ],
    ...

should be

            ...
            "include": "src",
            ...

and the loader was missing, too. There were no postLoaders, though.

For some reason I knew that the moment would come when I just misconfigured something and created an embarassing issue for no reason 😄

Thanks for pointing out the real issue!

Best regards,
miffels

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants