AnonSec Shell
Server IP : 185.86.78.101  /  Your IP : 216.73.216.124
Web Server : Apache
System : Linux 675867-vds-valikoshka1996.gmhost.pp.ua 5.4.0-150-generic #167-Ubuntu SMP Mon May 15 17:35:05 UTC 2023 x86_64
User : www ( 1000)
PHP Version : 7.4.33
Disable Function : passthru,exec,system,putenv,chroot,chgrp,chown,shell_exec,popen,proc_open,pcntl_exec,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,imap_open,apache_setenv
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : OFF
Directory :  /www/wwwroot/mifepriston.org/node_modules/webpack-cli/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ HOME ]     

Current File : /www/wwwroot/mifepriston.org/node_modules/webpack-cli/MIGRATE.md
## webpack-migrate

The `migrate` feature eases the transition from [version 1](http://webpack.github.io/docs/) to [version 2](https://gist.github.com/sokra/27b24881210b56bbaff7). `migrate`
also allows users to switch to the new version of webpack without having to extensively [refactor](https://webpack.js.org/guides/migrating/).

### Usage
To use `migrate`, run the following command, with the value of `<config>` being a path to an existing webpack configuration file

```bash
webpack-cli migrate <config>
```

Given a basic configuration file like so:

```javascript
const ExtractTextPlugin = require('extract-text-webpack-plugin');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const path = require('path');
const UglifyJSPlugin = require('uglifyjs-webpack-plugin');
const webpack = require('webpack');

module.exports = {

  entry: {
	index: './src/index.js',
	vendor: './src/vendor.js'
  },

  output: {
	filename: '[name].[chunkhash].js',
	chunkFilename: '[name].[chunkhash].js',
	path: path.resolve(__dirname, 'dist')
  },

  module: {
	loaders: [
	  {
		test: /\.js$/,
		exclude: /node_modules/,
		loader: 'babel',
		query: {
		  presets: ['env']
		}
	  },
	  {
		test: /\.(scss|css)$/,
		loader: ExtractTextPlugin.extract('style', 'css!sass')
	  }
	]
  },

  plugins: [
	new UglifyJSPlugin(),

	new ExtractTextPlugin('styles-[contentHash].css'),

	new webpack.optimize.CommonsChunkPlugin({
	  name: 'common',
	  filename: 'common-[hash].min.js'
	}),

	new HtmlWebpackPlugin()
  ]

};
```

The `migrate` command, when run, will show the proposed changes to the config file in the terminal, prompting the user to
accept the changes or not:

```diff
$ webpack-cli migrate ./webpack.config.js
 ✔ Reading webpack config
 ✔ Migrating config from v1 to v2
-    loaders: [
+      rules: [
-        loader: 'babel',
-          query: {
+            use: [{
+              loader: 'babel-loader'
+            }],
+            options: {
-              loader: ExtractTextPlugin.extract('style', 'css!sass')
+              use: ExtractTextPlugin.extract({
+                fallback: 'style',
+                use: 'css!sass'
+              })
? Are you sure these changes are fine? Yes

 ✔︎ New webpack v2 config file is at /Users/obuckley/Workspace/github/repos/webpack-migrate-sandbox/webpack.config.js
```


After it has run, we have our new webpack config file!

```javascript
const ExtractTextPlugin = require('extract-text-webpack-plugin');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const path = require('path');
const UglifyJSPlugin = require('uglifyjs-webpack-plugin');
const webpack = require('webpack');

module.exports = {

  entry: {
	index: './src/index.js',
	vendor: './src/vendor.js'
  },

  output: {
	filename: '[name].[chunkhash].js',
	chunkFilename: '[name].[chunkhash].js',
	path: path.resolve(__dirname, 'dist')
  },

  module: {
	rules: [
	  {
		test: /\.js$/,
		exclude: /node_modules/,
		use: [{
		  loader: 'babel-loader'
		}],
		options: {
		  presets: ['env']
		}
	  },
	  {
		test: /\.(scss|css)$/,
		use: ExtractTextPlugin.extract({
		  fallback: 'style',
		  use: 'css!sass'
		})
	  }
	]
  },

  plugins: [
	new UglifyJSPlugin(),

	new ExtractTextPlugin('styles-[contentHash].css'),

	new webpack.optimize.CommonsChunkPlugin({
	  name: 'common',
	  filename: 'common-[hash].min.js'
	}),

	new HtmlWebpackPlugin()
  ]

};
```

In summary, we can see the follow changes were made
1.  The webpack schema for using loaders has changed
    - `loaders` is now `module.rules`
    -  `query` is now `options`
1.  All loaders now have to have the *loader* suffix, e.g. `babel` -> `babel-loader`

**Note: This command does NOT handle updating dependencies in _package.json_, it is only a migration tool for the config
file itself.  Users are expected to manage dependencies themselves.**

Anon7 - 2022
AnonSec Team