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.

v2 Documentation on modifying webpack config

See original GitHub issue

📚 Documentation

This example showed in the v2 documentation (here) doesn’t work and it throws an error:

// docusaurus-plugin/src/index.js
module.exports = function(context, options) {
  return {
    name: 'docusaurus-plugin',
    configureWebpack(config, isServer, utils) {
      const {getCacheLoader} = utils;
      config.modules.rules.push({
        test: /\.foo$/,
        use: [getCacheLoader(isServer), 'my-custom-webpack-loader'],
      });
      return config;
    },
  };
};

./blog/2019-05-28-hola.md Module build failed (from ./node_modules/babel-loader/lib/index.js): SyntaxError: /Users/equinusocio/Repositories/Oval/docus/blog/2019-05-28-hola.md: Identifier ‘React’ has already been declared (7:275)

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:4
  • Comments:10 (7 by maintainers)

github_iconTop GitHub Comments

13reactions
endilieycommented, Dec 7, 2019

Ah… Of course it wont work. There is no such “my-custom-webpack-loader” … Its just to indicate that you can add your webpack loader there/ you can modify your config.

PR welcome to edit the docs with simpler example of modifying webpack config

But your error seems unrelated though ✌️ Did you import React in blog ⭕️

3reactions
BobLamarleycommented, Dec 17, 2019

Example https://github.com/algolia/docsearch-website/blob/master/plugins/my-loaders/index.js

How does this work, i’ve done the same as you : Added plugins/my-loaders folder as dependencies image Then, write my plugins/my-loaders/index.js content : image Then ‘npm start’ image

I got this error, even if i do a ‘npm install’, my project stay broken, no luck 😢 PS: All this stuff for passing a props to a component on a route 🙈

Read more comments on GitHub >

github_iconTop Results From Across the Web

Configuration - webpack
createapp.dev is an online tool for creating custom webpack configurations. It allows you to select various features that will be combined and added...
Read more >
To v2 or v3 from v1 - webpack
You can no longer configure a loader with a custom property in the webpack.config.js . It must be done through the options ....
Read more >
Development - webpack
Let's start by setting mode to 'development' and title to 'Development' . webpack.config.js const path = require('path'); const HtmlWebpackPlugin = require ...
Read more >
Resolve | webpack
Configure how modules are resolved. For example, when calling import 'lodash' in ES2015, the resolve options can change where webpack goes to look...
Read more >
Command Line Interface - webpack
Commands ; build, build|bundle|b [entries...] [options], Run webpack (default command, can be omitted). ; configtest, configtest|t [config-path], Validate a ...
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