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:
- Created 4 years ago
- Reactions:4
- Comments:10 (7 by maintainers)
Top 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 >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

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 ⭕️
How does this work, i’ve done the same as you : Added plugins/my-loaders folder as dependencies
Then, write my plugins/my-loaders/index.js content :
Then ‘npm start’

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 🙈