Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-platform
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
edx-platform
Commits
30385697
Commit
30385697
authored
Jun 26, 2017
by
David Ormsbee
Committed by
GitHub
Jun 26, 2017
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #15382 from edx/ormsbee/webpack_common_chunk_vagrant
Add support for CommonsChunkPlugin for Webpack.
parents
f9216656
962b09f7
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
28 additions
and
0 deletions
+28
-0
common/djangoapps/pipeline_mako/templates/static_content.html
+1
-0
common/static/common/js/karma.common.conf.js
+12
-0
webpack.config.js
+15
-0
No files found.
common/djangoapps/pipeline_mako/templates/static_content.html
View file @
30385697
...
@@ -96,6 +96,7 @@ source, template_path = Loader(engine).load_template_source(path)
...
@@ -96,6 +96,7 @@ source, template_path = Loader(engine).load_template_source(path)
try:
try:
return
Template
("""
return
Template
("""
{%
load
render_bundle
from
webpack_loader
%}
{%
load
render_bundle
from
webpack_loader
%}
{%
render_bundle
"
commons
"
%}
{%
render_bundle
entry
%}
{%
render_bundle
entry
%}
<
script
type=
"text/javascript"
>
<
script
type=
"text/javascript"
>
{% autoescape off %}{{ body }}{% endautoescape %}
{% autoescape off %}{{ body }}{% endautoescape %}
...
...
common/static/common/js/karma.common.conf.js
View file @
30385697
...
@@ -44,6 +44,18 @@ var webpackConfig = require(path.join(appRoot, 'webpack.config.js'));
...
@@ -44,6 +44,18 @@ var webpackConfig = require(path.join(appRoot, 'webpack.config.js'));
delete
webpackConfig
.
entry
;
delete
webpackConfig
.
entry
;
// The following crazy bit is to work around the webpack.optimize.CommonsChunkPlugin
// plugin. The problem is that it it factors out the code that defines webpackJsonp
// and puts in in the commons JS, which Karma doesn't know to load first. This is a
// workaround recommended in the karma-webpack bug report that basically just removes
// the plugin for the purposes of Karma testing (the plugin is meant to be an
// optimization only).
// https://github.com/webpack-contrib/karma-webpack/issues/24#issuecomment-257613167
//
// This should be fixed in v3 of karma-webpack
const
commonsChunkPluginIndex
=
webpackConfig
.
plugins
.
findIndex
(
plugin
=>
plugin
.
chunkNames
);
webpackConfig
.
plugins
.
splice
(
commonsChunkPluginIndex
,
1
);
// Files which are needed by all lms/cms suites.
// Files which are needed by all lms/cms suites.
var
commonFiles
=
{
var
commonFiles
=
{
libraryFiles
:
[
libraryFiles
:
[
...
...
webpack.config.js
View file @
30385697
...
@@ -54,6 +54,21 @@ var wpconfig = {
...
@@ -54,6 +54,21 @@ var wpconfig = {
$
:
'jquery'
,
$
:
'jquery'
,
jQuery
:
'jquery'
,
jQuery
:
'jquery'
,
'window.jQuery'
:
'jquery'
'window.jQuery'
:
'jquery'
}),
// Note: Until karma-webpack releases v3, it doesn't play well with
// the CommonsChunkPlugin. We have a kludge in karma.common.conf.js
// that dynamically removes this plugin from webpack config when
// running those tests (the details are in that file). This is a
// recommended workaround, as this plugin is just an optimization. But
// because of this, we really don't want to get too fancy with how we
// invoke this plugin until we can upgrade karma-webpack.
new
webpack
.
optimize
.
CommonsChunkPlugin
({
// If the value below changes, update the render_bundle call in
// common/djangoapps/pipeline_mako/templates/static_content.html
name
:
'commons'
,
filename
:
'commons.js'
,
minChunks
:
2
})
})
],
],
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment