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.

Add support for new webpack 2 fields

See original GitHub issue

Here are a few:

{
    modules: [path.resolve(__dirname, "app"), "node_modules"]
    // (was split into `root`, `modulesDirectories` and `fallback` in the old options)
    // In which folders the resolver look for modules
    // relative paths are looked up in every parent folder (like node_modules)
    // absolute paths are looked up directly
    // the order is respected

    descriptionFiles: ["package.json", "bower.json"],
    // These JSON files are read in directories

    mainFields: ["main", "browser"],
    // These fields in the description files are looked up when trying to resolve the package directory

    mainFiles: ["index"]
    // These files are tried when trying to resolve a directory

    aliasFields: ["browser"],
    // These fields in the description files offer aliasing in this package
    // The content of these fields is an object where requests to a key are mapped to the corresponding value

    extensions: [".js", ".json"],
    // These extensions are tried when resolving a file

    enforceExtension: false,
    // If false it will also try to use no extension from above

    moduleExtensions: ["-loader"],
    // These extensions are tried when resolving a module

    enforceModuleExtension: false,
    // If false it's also try to use no module extension from above

    alias: {
        jquery: path.resolve(__dirname, "vendor/jquery-2.0.0.js")
    }
    // These aliasing is used when trying to resolve a module
}

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:8
  • Comments:6

github_iconTop GitHub Comments

3reactions
wclrcommented, Jun 19, 2016

I believe modules should be allowed in resolve and resolveLoader

2reactions
danielkczcommented, Jun 9, 2016

Apart from changes mentioned above, there is also change to loader configuration.

Having loader like this fails with “1” must be a string

{ test: /\.css$/, include: srcPath, loaders: [
    'style',
    { loader: 'css', query: { modules: true }}
]},
Read more comments on GitHub >

github_iconTop Results From Across the Web

Entry Points - webpack
As mentioned in Getting Started, there are multiple ways to define the entry property in your webpack configuration. We will show you the...
Read more >
You may need an appropriate loader to handle this file type ...
When using public/private field declarations in an es6 class. Webpack fails to bundle with the below error ERROR in ./index.js 2:9 Module ...
Read more >
Webpack static field - Stack Overflow
Module parse failed: Unexpected character '#' (2:4) You may need an appropriate loader to handle this file type, currently no loaders are ...
Read more >
Getting Started With Webpack - Smashing Magazine
Modern browsers provide good support for JavaScript modules, but module bundlers such ... as the file having the new webpack configuration.
Read more >
How to setup Webpack config - Arek Nawo
There's also a new player in the field called Parcel.js. ... Lastly, let's get fancy and add support for bundling images aka static...
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