-
-
Notifications
You must be signed in to change notification settings - Fork 622
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
cli(migration): update UglifyJS transformation (#416)
* cli(migration): Update UglifyJS migration file to fit webpack4 configuration * cli(migration): Add cases where require variable does not need to exist * cli(migration): Add transformation for usage of webpack.otimization.UglifyPlugin * cli(tests): Update test snapshots after updating transformation * cli(fix): fix expressionContent being null * cli(refactor): remove plugins array if empty Created function on ast-utils so every other transformation can use this. * tests: add tests for new ast-utils method * fix: fix test names and jsdoc * fix: update maxSize for utils folder
- Loading branch information
1 parent
1761666
commit 4f8ebee
Showing
13 changed files
with
330 additions
and
83 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 3 additions & 1 deletion
4
lib/migrate/uglifyJsPlugin/__testfixtures__/uglifyJsPlugin-0.input.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,7 @@ | ||
const UglifyJsPlugin = require('uglifyjs-webpack-plugin'); | ||
|
||
module.exports = { | ||
plugins: [ | ||
new webpack.optimize.UglifyJsPlugin() | ||
new UglifyJsPlugin() | ||
] | ||
} |
6 changes: 5 additions & 1 deletion
6
lib/migrate/uglifyJsPlugin/__testfixtures__/uglifyJsPlugin-1.input.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,10 @@ | ||
const UglifyJsPlugin = require('uglifyjs-webpack-plugin'); | ||
module.exports = { | ||
devtool: "source-map", | ||
plugins: [ | ||
new webpack.optimize.UglifyJsPlugin({}) | ||
new UglifyJsPlugin({ | ||
sourceMap: true, | ||
compress: {} | ||
}) | ||
] | ||
} |
6 changes: 4 additions & 2 deletions
6
lib/migrate/uglifyJsPlugin/__testfixtures__/uglifyJsPlugin-2.input.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 26 additions & 0 deletions
26
lib/migrate/uglifyJsPlugin/__testfixtures__/uglifyJsPlugin-3.input.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
module.exports = { | ||
devtool: 'eval', | ||
entry: [ | ||
'./src/index' | ||
], | ||
output: { | ||
path: path.join(__dirname, 'dist'), | ||
filename: 'index.js' | ||
}, | ||
module: { | ||
loaders: [{ | ||
test: /.js$/, | ||
loaders: ['babel'], | ||
include: path.join(__dirname, 'src') | ||
}] | ||
}, | ||
resolve: { | ||
root: path.resolve('/src'), | ||
modules: ['node_modules'] | ||
}, | ||
plugins: [ | ||
new webpack.optimize.UglifyJsPlugin(), | ||
new webpack.optimize.OccurrenceOrderPlugin() | ||
], | ||
debug: true | ||
}; |
28 changes: 28 additions & 0 deletions
28
lib/migrate/uglifyJsPlugin/__testfixtures__/uglifyJsPlugin-4.input.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
module.exports = { | ||
devtool: 'eval', | ||
entry: [ | ||
'./src/index' | ||
], | ||
output: { | ||
path: path.join(__dirname, 'dist'), | ||
filename: 'index.js' | ||
}, | ||
module: { | ||
loaders: [{ | ||
test: /.js$/, | ||
loaders: ['babel'], | ||
include: path.join(__dirname, 'src') | ||
}] | ||
}, | ||
resolve: { | ||
root: path.resolve('/src'), | ||
modules: ['node_modules'] | ||
}, | ||
plugins: [ | ||
new webpack.optimize.UglifyJsPlugin({ | ||
sourceMap: true | ||
}), | ||
new webpack.optimize.OccurrenceOrderPlugin() | ||
], | ||
debug: true | ||
}; |
Oops, something went wrong.