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

ReferenceError: process is not defined #16

Closed
Deep-Codes opened this issue Feb 16, 2021 · 2 comments
Closed

ReferenceError: process is not defined #16

Deep-Codes opened this issue Feb 16, 2021 · 2 comments

Comments

@Deep-Codes
Copy link
Contributor

Hey Fantastic Boilerplate, I had an issue which I solved I will place it here so that People can Solve it if they get Stuck.

Steps to Reproduce:

git clone [email protected]:KaiHotz/react-rollup-boilerplate.git
cd react-rollup-boilerplate
npm install or yarn
yarn start

Error Message at http://localhost:6060/

Screenshot 2021-02-16 at 7 23 12 PM

FIX for this:

yarn add -D process

Add Process Plugin to webpack.config.js

  plugins: [
    new webpack.ProvidePlugin({
      process: 'process/browser',
    }),
  ],

So complete webpack.config.js file:

// Webpack configuration
const webpack = require('webpack');

module.exports = {
  module: {
    rules: [
      { test: /\.tsx?$/, loader: 'ts-loader' },
      { enforce: 'pre', test: /\.js$/, loader: 'source-map-loader' },
      {
        test: /\.(js|jsx)$/,
        exclude: /node_modules/,
        use: ['babel-loader'],
      },
      {
        test: /\.(s?)css$/,
        use: ['style-loader', 'css-loader', 'sass-loader'],
      },
      {
        test: /\.(png|jpg|jpeg|webp|gif)$/,
        use: ['url-loader'],
      },
      {
        test: /\.svg$/,
        use: [
          {
            loader: '@svgr/webpack',
          },
        ],
      },
    ],
  },
  devtool: 'source-map',
  resolve: { extensions: ['.ts', '.tsx', '.js', '.jsx', '.json'] },
  plugins: [
    new webpack.ProvidePlugin({
      process: 'process/browser',
    }),
  ],
};

Solved!

Screenshot 2021-02-16 at 7 26 37 PM

@Deep-Codes
Copy link
Contributor Author

Hope this Helps 👍🏽

@KaiHotz
Copy link
Owner

KaiHotz commented Feb 16, 2021

@Deep-Codes thanks for the PR and the Fix, PR got approved and merged.
Had to do a bit of cleanup since there was a package-lock and yarn.lock file.
I'm glad you liked it and also thankful for your contribution.

@KaiHotz KaiHotz closed this as completed Feb 16, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants