Revert "Merge pull request #17325 from cpennington/switch-asset-index-factory-to-webpack"
This reverts commit1c46bd89c3, reversing changes made toeb6064e333.
This commit is contained in:
@@ -7,7 +7,12 @@ var webpack = require('webpack');
|
||||
var BundleTracker = require('webpack-bundle-tracker');
|
||||
var StringReplace = require('string-replace-webpack-plugin');
|
||||
|
||||
var files = require('./webpack-config/file-lists.js');
|
||||
var namespacedRequireFiles = [
|
||||
path.resolve(__dirname, 'common/static/common/js/components/views/feedback_notification.js'),
|
||||
path.resolve(__dirname, 'common/static/common/js/components/views/feedback_prompt.js'),
|
||||
path.resolve(__dirname, 'common/static/common/js/components/views/feedback.js'),
|
||||
path.resolve(__dirname, 'common/static/common/js/components/utils/view_utils.js')
|
||||
];
|
||||
|
||||
var defineHeader = /\(function ?\(define(, require)?\) ?\{/;
|
||||
var defineFooter = /\}\)\.call\(this, define \|\| RequireJS\.define(, require \|\| RequireJS\.require)?\);/;
|
||||
@@ -20,8 +25,6 @@ module.exports = {
|
||||
Import: './cms/static/js/features/import/factories/import.js',
|
||||
CourseOrLibraryListing: './cms/static/js/features_jsx/studio/CourseOrLibraryListing.jsx',
|
||||
'js/pages/login': './cms/static/js/pages/login.js',
|
||||
'js/pages/asset_index': './cms/static/js/pages/asset_index.js',
|
||||
'js/sock': './cms/static/js/sock.js',
|
||||
|
||||
// LMS
|
||||
SingleSupportForm: './lms/static/support/jsx/single_support_form.jsx',
|
||||
@@ -94,7 +97,7 @@ module.exports = {
|
||||
],
|
||||
rules: [
|
||||
{
|
||||
test: files.namespacedRequire,
|
||||
test: namespacedRequireFiles,
|
||||
loader: StringReplace.replace(
|
||||
['babel-loader'],
|
||||
{
|
||||
@@ -111,26 +114,11 @@ module.exports = {
|
||||
}
|
||||
)
|
||||
},
|
||||
{
|
||||
test: files.textBangUnderscore,
|
||||
loader: StringReplace.replace(
|
||||
['babel-loader'],
|
||||
{
|
||||
replacements: [
|
||||
{
|
||||
pattern: /text!(.*\.underscore)/,
|
||||
replacement: function(match, p1) { return p1; }
|
||||
}
|
||||
]
|
||||
}
|
||||
)
|
||||
},
|
||||
{
|
||||
test: /\.(js|jsx)$/,
|
||||
exclude: [
|
||||
/node_modules/,
|
||||
files.namespacedRequire,
|
||||
files.textBangUnderscore
|
||||
namespacedRequireFiles
|
||||
],
|
||||
use: 'babel-loader'
|
||||
},
|
||||
@@ -142,16 +130,9 @@ module.exports = {
|
||||
use: 'babel-loader'
|
||||
},
|
||||
{
|
||||
test: path.resolve(__dirname, 'common/static/coffee/src/ajax_prefix.js'),
|
||||
use: [
|
||||
'babel-loader',
|
||||
{
|
||||
loader: 'exports-loader',
|
||||
options: {
|
||||
'this.AjaxPrefix': true
|
||||
}
|
||||
}
|
||||
]
|
||||
test: /\.coffee$/,
|
||||
exclude: /node_modules/,
|
||||
use: 'coffee-loader'
|
||||
},
|
||||
{
|
||||
test: /\.underscore$/,
|
||||
@@ -161,34 +142,13 @@ module.exports = {
|
||||
// This file is used by both RequireJS and Webpack and depends on window globals
|
||||
// This is a dirty hack and shouldn't be replicated for other files.
|
||||
test: path.resolve(__dirname, 'cms/static/cms/js/main.js'),
|
||||
loader: StringReplace.replace(
|
||||
['babel-loader'],
|
||||
{
|
||||
replacements: [
|
||||
{
|
||||
pattern: /\(function\(AjaxPrefix\) {/,
|
||||
replacement: function() { return ''; }
|
||||
},
|
||||
{
|
||||
pattern: /], function\(domReady, \$, str, Backbone, gettext, NotificationView\) {/,
|
||||
replacement: function() {
|
||||
// eslint-disable-next-line
|
||||
return '], function(domReady, $, str, Backbone, gettext, NotificationView, AjaxPrefix) {';
|
||||
}
|
||||
},
|
||||
{
|
||||
pattern: /'..\/..\/common\/js\/components\/views\/feedback_notification',/,
|
||||
replacement: function() {
|
||||
return "'../../common/js/components/views/feedback_notification', 'AjaxPrefix',";
|
||||
}
|
||||
},
|
||||
{
|
||||
pattern: /}\).call\(this, AjaxPrefix\);/,
|
||||
replacement: function() { return ''; }
|
||||
}
|
||||
]
|
||||
use: {
|
||||
loader: 'imports-loader',
|
||||
options: {
|
||||
AjaxPrefix:
|
||||
'exports-loader?this.AjaxPrefix!../../../../common/static/coffee/src/ajax_prefix.coffee'
|
||||
}
|
||||
)
|
||||
}
|
||||
},
|
||||
{
|
||||
test: /\.(woff2?|ttf|svg|eot)(\?v=\d+\.\d+\.\d+)?$/,
|
||||
@@ -198,9 +158,8 @@ module.exports = {
|
||||
},
|
||||
|
||||
resolve: {
|
||||
extensions: ['.js', '.jsx', '.json'],
|
||||
extensions: ['.js', '.jsx', '.json', '.coffee'],
|
||||
alias: {
|
||||
AjaxPrefix: 'ajax_prefix',
|
||||
'edx-ui-toolkit': 'edx-ui-toolkit/src/', // @TODO: some paths in toolkit are not valid relative paths
|
||||
'jquery.ui': 'jQuery-File-Upload/js/vendor/jquery.ui.widget.js',
|
||||
jquery: 'jquery/src/jquery', // Use the non-dist form of jQuery for better debugging + optimization
|
||||
@@ -209,21 +168,13 @@ module.exports = {
|
||||
// https://github.com/webpack/webpack/issues/304#issuecomment-272150177
|
||||
// (I've tried every other suggestion solution on that page, this
|
||||
// was the only one that worked.)
|
||||
sinon: __dirname + '/node_modules/sinon/pkg/sinon.js',
|
||||
'jquery.smoothScroll': 'jquery.smooth-scroll.min',
|
||||
'jquery.timepicker': 'timepicker/jquery.timepicker',
|
||||
datepair: 'timepicker/datepair',
|
||||
accessibility: 'accessibility_tools',
|
||||
ieshim: 'ie_shim'
|
||||
sinon: __dirname + '/node_modules/sinon/pkg/sinon.js'
|
||||
},
|
||||
modules: [
|
||||
'node_modules',
|
||||
'cms/static',
|
||||
'common/static',
|
||||
'common/static/js/src',
|
||||
'common/static/js/vendor/',
|
||||
'common/static/js/vendor/jQuery-File-Upload/js/',
|
||||
'common/static/coffee/src'
|
||||
'cms/static',
|
||||
'common/static/js/src'
|
||||
]
|
||||
},
|
||||
|
||||
|
||||
Reference in New Issue
Block a user