Last active
May 13, 2020 23:18
-
-
Save rebolyte/8e6c65bd50b043ac921206c5b9a65c73 to your computer and use it in GitHub Desktop.
Webpack script-loader problems
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
webpackJsonp([0],{ | |
/***/ "../../Components/App/UserWidgets/Widgets/News.js": | |
/***/ (function(module, exports) { | |
require("!!C:\\Web Apps\\Tools\\Webpack\\node_modules\\script-loader\\addScript.js")(require("!!C:\\Web Apps\\Tools\\Webpack\\node_modules\\raw-loader\\index.js!C:\\Web Apps\\Components\\App\\UserWidgets\\Widgets\\News.js")) | |
/***/ }), | |
/***/ "../../Components/App/UserWidgets/Widgets/UserAlerts.js": | |
/***/ (function(module, exports) { | |
require("!!C:\\Web Apps\\Tools\\Webpack\\node_modules\\script-loader\\addScript.js")(require("!!C:\\Web Apps\\Tools\\Webpack\\node_modules\\raw-loader\\index.js!C:\\Web Apps\\Components\\App\\UserWidgets\\Widgets\\UserAlerts.js")) | |
/***/ }), | |
/***/ "../../Components/App/UserWidgets/Widgets/UserAssignments.js": | |
/***/ (function(module, exports) { | |
require("!!C:\\Web Apps\\Tools\\Webpack\\node_modules\\script-loader\\addScript.js")(require("!!C:\\Web Apps\\Tools\\Webpack\\node_modules\\raw-loader\\index.js!C:\\Web Apps\\Components\\App\\UserWidgets\\Widgets\\UserAssignments.js")) | |
/***/ }), | |
/***/ "../../Components/App/UserWidgets/Widgets/WidgetBase.js": | |
/***/ (function(module, exports) { | |
require("!!C:\\Web Apps\\Tools\\Webpack\\node_modules\\script-loader\\addScript.js")(require("!!C:\\Web Apps\\Tools\\Webpack\\node_modules\\raw-loader\\index.js!C:\\Web Apps\\Components\\App\\UserWidgets\\Widgets\\WidgetBase.js")) | |
/***/ }), | |
/***/ 0: | |
/***/ (function(module, exports, __webpack_require__) { | |
__webpack_require__("../../Components/App/UserWidgets/Widgets/WidgetBase.js"); | |
__webpack_require__("../../Components/App/UserWidgets/Widgets/News.js"); | |
__webpack_require__("../../Components/App/UserWidgets/Widgets/UserAlerts.js"); | |
module.exports = __webpack_require__("../../Components/App/UserWidgets/Widgets/UserAssignments.js"); | |
/***/ }) | |
},[0]); |
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
if (Ext4 === undefined) { window.Ext4 = Ext; } | |
Ext4.define('UserAlerts', (function () { | |
return { | |
extend: 'WidgetBase', | |
height:40, | |
data: {}, | |
cls: 'UserAlerts', | |
listeners: { | |
'updateData': function(params) { | |
this.handleData(params); | |
} | |
}, | |
constructor: function(config) { | |
var me = this, | |
e = Ext4; | |
config = e.apply({ | |
items: [ | |
{ xtype: 'menuseparator' }, | |
{ | |
xtype: 'component', | |
html: 'Yo' | |
} | |
], | |
DisplayComponentConfig: { | |
items: [{ | |
xtype: 'component', | |
html: 'Sup' | |
}], | |
width:250, | |
height:100 | |
} | |
}, config); | |
UserAlerts.superclass.constructor.call(this, config); | |
}, | |
validate: function(params){ | |
return true; | |
}, | |
handleData: function() { | |
} | |
}; | |
})()); |
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
import webpack from 'webpack'; | |
import path from 'path'; | |
const bundleConfig = { | |
"Bundles/legacyJS": [ | |
"UserWidgets/Widgets/WidgetBase.js", | |
"UserWidgets/Widgets/News.js", | |
"UserWidgets/Widgets/UserAlerts.js", | |
"UserWidgets/Widgets/UserAssignments.js" | |
// ... | |
] | |
}; | |
const paths = { | |
srcParent: '../../Components/App/', | |
distParent: '../../Components/App/Dist' | |
}; | |
// prepend parent dir to paths in bundle config | |
Object.keys(bundleConfig).forEach(bundleName => { | |
bundleConfig[bundleName] = bundleConfig[bundleName].map(src => { | |
return /\.(js$|s?css$)/.test(src) ? paths.srcParent + src : src; | |
}); | |
}); | |
const legacyMatcher = /(?:Components\\App\\js\\.+\.js$)|(?:Components\\App\\UserWidgets\\.+\.js$)/; | |
export default { | |
entry: bundleConfig, | |
output: { | |
filename: 'Scripts/[name].[chunkhash:10].js', | |
path: path.resolve(paths.distParent), | |
}, | |
plugins: [ | |
new webpack.NamedModulesPlugin(), | |
new webpack.optimize.CommonsChunkPlugin({ | |
name: 'manifest', | |
minChunks: Infinity | |
}), | |
], | |
module: { | |
// noParse: legacyMatcher, // <-- THIS WAS THE ISSUE | |
rules: [ | |
{ | |
test: legacyMatcher, | |
exclude: [ | |
/node_modules/, | |
/vendors/ | |
], | |
use: [ | |
{ loader: 'script-loader' } | |
] | |
} | |
] | |
} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment