All Questions
929
questions
34
votes
5
answers
156k
views
React Js require 'fs'
I have
import fs from 'fs'
and in my package.json I have
Then I run the command
> npm i fs
> [email protected] node_modules/fs
next in my React store I import 'fs' module
import ...
15
votes
4
answers
17k
views
How to hash CSS class names in Nextjs?
How can I edit localIdentName field of css-loader in Webpack configuration in Nextjs so that I can hash/hide/obfuscate css class names?
The example below is from the New York Times. Note the class ...
8
votes
3
answers
13k
views
How can I fix the "BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default" error?
I am trying to build a react app but each time I run npm start, I am greeted with this message
Module not found: Error: Can't resolve 'buffer' in '/Users/abdus/Documents/GitHub/keywords-tracker/...
244
votes
5
answers
170k
views
What does this "react-scripts eject" command do?
What does the npm run eject command do? I do understand what other commands do like start, build, test. But no idea about eject.
225
votes
19
answers
416k
views
How to use Google fonts in React.js?
I had built a website with React.js and webpack.
I want to use Google fonts in the webpage, so I put the link in the section.
Google Fonts
<link href="https://fonts.googleapis.com/css?family=...
220
votes
22
answers
481k
views
How to include bootstrap css and js in reactjs app?
I am new to ReactJS, I want to include bootstrap in my React app
I have installed bootstrap by npm install bootstrap --save
Now, want to load bootstrap CSS and JS in my React app.
I am using webpack.
...
188
votes
35
answers
517k
views
Invalid configuration object. Webpack has been initialised using a configuration object that does not match the API schema
I have this simple helloworld react app created from an online course, however I get this error:
Invalid configuration object. Webpack has been initialised using a
configuration object that does ...
42
votes
10
answers
52k
views
Importing CSS files in Isomorphic React Components
I have a React application with Components written in ES6 - transpiled via Babel and Webpack.
In some places I would like to include specific CSS files with specific Components, as suggested in react ...
24
votes
1
answer
14k
views
Webpack output is empty object
I want to build a react component library as a node module to then import it into different projects. But if I try to import a component it just returns an empty object.
button.jsx:
import React, {...
8
votes
4
answers
17k
views
Uncaught TypeError: fs.readFileSync is not a function
I am trying to get webpack and mapbox-gl work together within Meteor system. I have look everywhere about the error mentioned above but none works. Here is my webpack setup
{
"root": "src",
"...
6
votes
1
answer
1k
views
Value of "this" is incorrect when debugging Babel transpiled React with Chrome Devtools
I have a React application that is transpiled with Babel using the following .babelrc configuration
{
"presets": [
"es2015",
"stage-1",
"react"
],
"plugins": [
"transform-...
129
votes
13
answers
164k
views
Preset files are not allowed to export objects
I have a carousel file in which I want to get index.js and build block.build.js, so my webpack.config.js is:
var config = {
entry: './index.js',
output: {
path: __dirname,
filename: '...
122
votes
8
answers
239k
views
Webpack how to build production code and how to use it
I am very new to webpack, I found that in production build we can able to reduce the size of overall code.
Currently webpack builds around 8MB files and main.js around 5MB.
How to reduce the size of ...
65
votes
5
answers
45k
views
How to minimize the size of webpack's bundle?
I'm writing a web app using react and webpack as my module bundler.
My jsx code is really light so far, the size of the entire folder is 25 kb.
My bundle.js created from webpack is 2.2 mb though. ...
60
votes
10
answers
113k
views
how to set up an inline svg with webpack
I am wondering how to set up an inline svg with webpack?
I am following the react-webpack-cookbook.
I have my webpack.config set up correctly with the file loader.
However the example shows ...