Skip to content

Commit

Permalink
fix: use string-replace-loader instead of `string-replace-webpack-p…
Browse files Browse the repository at this point in the history
…lugin`
  • Loading branch information
brian-smith-tcril committed Apr 12, 2024
1 parent 3fdbdb2 commit a8822d4
Show file tree
Hide file tree
Showing 3 changed files with 62 additions and 107 deletions.
137 changes: 32 additions & 105 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,6 @@
"sass": "^1.54.8",
"sass-loader": "^14.1.1",
"scriptjs": "2.5.9",
"string-replace-webpack-plugin": "0.1.3",
"style-loader": "0.18.2",
"svg-inline-loader": "0.8.2",
"uglify-js": "2.7.0",
Expand Down Expand Up @@ -115,6 +114,7 @@
"selenium-webdriver": "3.4.0",
"sinon": "2.3.5",
"squirejs": "0.1.0",
"string-replace-loader": "^3.1.0",
"stylelint-formatter-pretty": "1.0.3",
"webpack-cli": "^5.1.4"
}
Expand Down
30 changes: 29 additions & 1 deletion webpack.common.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
var path = require('path');
var webpack = require('webpack');
var BundleTracker = require('webpack-bundle-tracker');
var StringReplace = require('string-replace-webpack-plugin');
var Merge = require('webpack-merge');

var files = require('./webpack-config/file-lists.js');
Expand Down Expand Up @@ -168,6 +167,35 @@ module.exports = Merge.smart({
/\/sinon\.js|codemirror-compressed\.js|hls\.js|tinymce.js/
],
rules: [
{
test: files.namespacedRequire.concat(files.textBangUnderscore, filesWithRequireJSBlocks),
loader: 'string-replace-loader',
options: {
multiple: [
{ search: defineHeader, replace: '' },
{ search: defineFooter, replace: '' },
{
search: /(\/\* RequireJS) \*\//g,
replace(match, p1, offset, string) {
return p1;
}
},
{
search: /\/\* Webpack/g,
replace(match, p1, offset, string) {
return match + ' */';
}
},
{
search: /text!(.*?\.underscore)/g,
replace(match, p1, offset, string) {
return p1;
}
},
{ search: /RequireJS.require/g, replace: 'require' }
]
}
},
{
test: /\.(js|jsx)$/,
exclude: [
Expand Down

0 comments on commit a8822d4

Please sign in to comment.