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

🐞[init]: entry point does not appears in newly generated config #976

Closed
pranshuchittora opened this issue Jun 27, 2019 · 8 comments · Fixed by #977
Closed

🐞[init]: entry point does not appears in newly generated config #976

pranshuchittora opened this issue Jun 27, 2019 · 8 comments · Fixed by #977

Comments

@pranshuchittora
Copy link
Member

Describe the bug

The missing entry point in the generated config.

What is the current behavior?
Missing entry point

To Reproduce
Steps to reproduce the behavior:

  1. webpack-cli init
  2. give entry point name
  3. check webpack.config.js

Expected behavior
Entry point must exist

@evenstensberg
Copy link
Member

Got screenshots?

@pranshuchittora
Copy link
Member Author

After running init

wasd@turing-machine  ~/webpack/testing 
./node_modules/.bin/webpack-cli init

ℹ INFO For more information and a detailed description of each question, have a look at: https://github.com/webpack/webpack-cli/blob/master/INIT.md
ℹ INFO Alternatively, run "webpack(-cli) --help" for usage info

? Will your application have multiple bundles? No
? Which will be your application entry point? efg
? In which folder do you want to store your generated bundles? 'dist'
? Will you use one of the below JS solutions? No
? Will you use one of the below CSS solutions? No
? If you want to bundle your CSS files, what will you name the bundle? (
press enter to skip) 'main.css'
identical package.json
create efg.js
identical README.md
identical index.html
yarn add v1.12.3
[1/4] Resolving packages...
[2/4] Fetching packages...
warning Pattern ["webpack@^4.35.2"] is trying to unpack in the same destination "/home/wasd/.cache/yarn/v4/npm-webpack-4.35.2-5c8b8a66602cbbd6ec65c6e6747914a61c1449b1/node_modules/webpack" as pattern ["[email protected]"]. This could result in non-deterministic behavior, skipping.
warning Pattern ["webpack-dev-server@^3.7.2"] is trying to unpack in the same destination "/home/wasd/.cache/yarn/v4/npm-webpack-dev-server-3.7.2-f79caa5974b7f8b63268ef5421222a8486d792f5/node_modules/webpack-dev-server" as pattern ["webpack-dev-server@^3.1.10"]. This could result in non-deterministic behavior, skipping.
warning Pattern ["terser-webpack-plugin@^1.3.0"] is trying to unpack in the same destination "/home/wasd/.cache/yarn/v4/npm-terser-webpack-plugin-1.3.0-69aa22426299f4b5b3775cbed8cb2c5d419aa1d4/node_modules/terser-webpack-plugin" as pattern ["terser-webpack-plugin@^1.1.0","terser-webpack-plugin@^1.1.0"]. This could result in non-deterministic behavior, skipping.
info [email protected]: The platform "linux" is incompatible with this module.
info "[email protected]" is an optional dependency and failed compatibility check. Excluding it from installation.
[3/4] Linking dependencies...
warning "@webpack-cli/init > @webpack-cli/generators > [email protected]" has unmet peer dependency "inquirer@^5.0.0 || ^6.0.0".
[4/4] Building fresh packages...
warning "webpack-cli" is already in "dependencies". Please remove existing entry first before adding it to "devDependencies".
success Saved 7 new dependencies.
info Direct dependencies
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
└─ [email protected]
info All dependencies
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
└─ [email protected]
Done in 4.94s.

Congratulations! Your new webpack configuration file has been created!

You can now run yarn build to bundle your application!

wasd@turing-machine  ~/webpack/testing 
cat webpack.config.js
const path = require('path');
const webpack = require('webpack');

/*

  • SplitChunksPlugin is enabled by default and replaced
  • deprecated CommonsChunkPlugin. It automatically identifies modules which
  • should be splitted of chunk by heuristics using module duplication count and
  • module category (i. e. node_modules). And splits the chunks…
  • It is safe to remove "splitChunks" from the generated configuration
  • and was added as an educational example.
  • https://webpack.js.org/plugins/split-chunks-plugin/

*/

const HtmlWebpackPlugin = require('html-webpack-plugin');

/*

*/

/*

*/

const TerserPlugin = require('terser-webpack-plugin');

const workboxPlugin = require('workbox-webpack-plugin');

module.exports = {
mode: 'production',
entry: './def.js',

plugins: [
	new webpack.ProgressPlugin(),
	new HtmlWebpackPlugin({
		template: 'index.html'
	}),
	new workboxPlugin.GenerateSW({
		swDest: 'sw.js',
		clientsClaim: true,
		skipWaiting: false
	})
],

module: {
	rules: []
},

devServer: {
	open: true
},

optimization: {
	minimizer: [new TerserPlugin()],

	splitChunks: {
		chunks: 'all'
	}
}

};
wasd@turing-machine  ~/webpack/testing 

@pranshuchittora
Copy link
Member Author

pranshuchittora commented Jul 3, 2019

In the above comment, you can see that I have given entry point as efg and in the generated config it is def.

@pranshuchittora
Copy link
Member Author

Reason for this is yo-rc.json.

My .yo-rc.json

{
  "*": {
    "configuration": {
      "config": {
        "topScope": [
          "const webpack = require('webpack')",
          "const path = require('path')",
          "\n",
          "/*\n * SplitChunksPlugin is enabled by default and replaced\n * deprecated CommonsChunkPlugin. It automatically identifies modules which\n * should be splitted of chunk by heuristics using module duplication count and\n * module category (i. e. node_modules). And splits the chunks…\n *\n * It is safe to remove \"splitChunks\" from the generated configuration\n * and was added as an educational example.\n *\n * https://webpack.js.org/plugins/split-chunks-plugin/\n *\n */",
          "/*\n * We've enabled UglifyJSPlugin for you! This minifies your app\n * in order to load faster and run less javascript.\n *\n * https://github.com/webpack-contrib/uglifyjs-webpack-plugin\n *\n */",
          "const UglifyJSPlugin = require('uglifyjs-webpack-plugin');",
          "\n"
        ],
        "webpackOptions": {
          "module": {
            "rules": []
          },
          "output": {
            "chunkFilename": "'[name].[chunkhash].js'",
            "filename": "'[name].[chunkhash].js'",
            "path": "path.resolve(__dirname, 'gdfgfdg')"
          },
          "mode": "'development'",
          "plugins": ["new UglifyJSPlugin()"],
          "optimization": {
            "splitChunks": {
              "cacheGroups": {
                "vendors": {
                  "priority": -10,
                  "test": "/[\\\\/]node_modules[\\\\/]/"
                }
              },
              "chunks": "'async'",
              "minChunks": 1,
              "minSize": 30000,
              "name": true
            }
          }
        },
        "configName": "config"
      }
    }
  },
  "testing": {
    "configuration": {
      "config": {
        "configName": "config",
        "topScope": [
          "const path = require('path');",
          "const webpack = require('webpack');",
          "\n",
          "/*\n * SplitChunksPlugin is enabled by default and replaced\n * deprecated CommonsChunkPlugin. It automatically identifies modules which\n * should be splitted of chunk by heuristics using module duplication count and\n * module category (i. e. node_modules). And splits the chunks…\n *\n * It is safe to remove \"splitChunks\" from the generated configuration\n * and was added as an educational example.\n *\n * https://webpack.js.org/plugins/split-chunks-plugin/\n *\n */",
          "const HtmlWebpackPlugin = require('html-webpack-plugin')",
          "\n",
          "/*\n * We've enabled HtmlWebpackPlugin for you! This generates a html\n * page for you when you compile webpack, which will make you start\n * developing and prototyping faster.\n * \n * https://github.com/jantimon/html-webpack-plugin\n * \n */",
          "/*\n * We've enabled TerserPlugin for you! This minifies your app\n * in order to load faster and run less javascript.\n *\n * https://github.com/webpack-contrib/terser-webpack-plugin\n *\n */",
          "const TerserPlugin = require('terser-webpack-plugin');",
          "\n",
          "const workboxPlugin = require('workbox-webpack-plugin');",
          "\n"
        ],
        "webpackOptions": {
          "mode": "'production'",
          "entry": "'./efg.js'",
          "plugins": [
            "new webpack.ProgressPlugin()",
            "new HtmlWebpackPlugin({\n\t\t\t\t\ttemplate: 'index.html'\n\t\t\t\t})",
            "new workboxPlugin.GenerateSW({\n\t\t\tswDest: 'sw.js',\n\t\t\tclientsClaim: true,\n\t\t\tskipWaiting: false,\n\t\t})"
          ],
          "module": {
            "rules": []
          },
          "devServer": {
            "open": true
          },
          "optimization": {
            "minimizer": ["new TerserPlugin()"],
            "splitChunks": {
              "chunks": "'all'"
            }
          }
        }
      }
    }
  },
  "testing2": {
    "configuration": {
      "config": {
        "configName": "config",
        "topScope": [
          "const path = require('path');",
          "const webpack = require('webpack');",
          "\n",
          "/*\n * SplitChunksPlugin is enabled by default and replaced\n * deprecated CommonsChunkPlugin. It automatically identifies modules which\n * should be splitted of chunk by heuristics using module duplication count and\n * module category (i. e. node_modules). And splits the chunks…\n *\n * It is safe to remove \"splitChunks\" from the generated configuration\n * and was added as an educational example.\n *\n * https://webpack.js.org/plugins/split-chunks-plugin/\n *\n */",
          "const HtmlWebpackPlugin = require('html-webpack-plugin')",
          "\n",
          "/*\n * We've enabled HtmlWebpackPlugin for you! This generates a html\n * page for you when you compile webpack, which will make you start\n * developing and prototyping faster.\n * \n * https://github.com/jantimon/html-webpack-plugin\n * \n */",
          "/*\n * We've enabled TerserPlugin for you! This minifies your app\n * in order to load faster and run less javascript.\n *\n * https://github.com/webpack-contrib/terser-webpack-plugin\n *\n */",
          "const TerserPlugin = require('terser-webpack-plugin');",
          "\n",
          "const workboxPlugin = require('workbox-webpack-plugin');",
          "\n"
        ],
        "webpackOptions": {
          "mode": "'production'",
          "entry": "'./bcd.js'",
          "plugins": [
            "new webpack.ProgressPlugin()",
            "new HtmlWebpackPlugin({\n\t\t\t\t\ttemplate: 'index.html'\n\t\t\t\t})",
            "new workboxPlugin.GenerateSW({\n\t\t\tswDest: 'sw.js',\n\t\t\tclientsClaim: true,\n\t\t\tskipWaiting: false,\n\t\t})"
          ],
          "module": {
            "rules": []
          },
          "devServer": {
            "open": true
          },
          "optimization": {
            "minimizer": ["new TerserPlugin()"],
            "splitChunks": {
              "chunks": "'all'"
            }
          }
        }
      }
    }
  }
}

@pranshuchittora
Copy link
Member Author

I have changed the package name from testing to testing2 and finally back to testing in package.json
When init encounters the same package name it doesn't update the .yo-rc.json even when the values are different.

@misterdev
Copy link
Contributor

I've tried downloading webpack-cli and @webpack-cli/init from npm, and also using my local repository updated with the latest commit from webpack-cli:master, but I can't reproduce this

  1. npm i webpack-cli @webpack-cli/init
  2. npx webpack-cli init
  3. Gave as entry point name 'efg'

Screenshot 2019-07-04 at 01 01 59

Screenshot 2019-07-04 at 01 02 11

@evenstensberg
Copy link
Member

Same here, that's why I'm curious of why this fails

@evenstensberg
Copy link
Member

Up for grabs, good first contribution

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants