add WEBPACK_ANALYSIS and WEBPACK_PEDANTIC flags
flag = none set WEBPACK_PEDANTIC=0 to prevent the build from bailing on warnings set WEBPACK_ANALYSIS=1 to generate an html report of the bundles test plan :: run webpack with the analysis flag and verify it 1) works and 2) generates a report at tmp/webpack-bundle-analysis.html WEBPACK_ANALYSIS=1 \ WEBPACK_PEDANTIC=0 \ NODE_OPTIONS="--max_old_space_size=8096" \ npx webpack Change-Id: Icc77b2477c2fb9d3394e4c41d2377212f93534c6 Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/261892 Reviewed-by: Ed Schiebel <eschiebel@instructure.com> Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com> QA-Review: Ahmad Amireh <ahmad@instructure.com> Product-Review: Ahmad Amireh <ahmad@instructure.com>
This commit is contained in:
parent
f9818a78a9
commit
30a45abac9
|
@ -1,7 +1,6 @@
|
|||
/gems/canvas_i18nliner/*
|
||||
/doc/*
|
||||
|
||||
spec/selenium/helpers/jquery.simulate.js
|
||||
spec/javascripts/support/jquery.mockjax.js
|
||||
|
||||
packages/**/node_modules/**
|
||||
/frontend_build/**
|
||||
/gems/canvas_i18nliner/*
|
||||
/packages/*/node_modules/**
|
||||
/spec/javascripts/support/jquery.mockjax.js
|
||||
/spec/selenium/helpers/jquery.simulate.js
|
|
@ -34,6 +34,7 @@ const I18nPlugin = require('./i18nPlugin')
|
|||
const WebpackHooks = require('./webpackHooks')
|
||||
const SourceFileExtensionsPlugin = require('./SourceFileExtensionsPlugin')
|
||||
const webpackPublicPath = require('./webpackPublicPath')
|
||||
|
||||
require('./bundles')
|
||||
|
||||
// We have a bunch of things (like our selenium jenkins builds) that have
|
||||
|
@ -50,6 +51,10 @@ const skipSourcemaps = Boolean(
|
|||
)
|
||||
|
||||
const root = path.resolve(__dirname, '..')
|
||||
const createBundleAnalyzerPlugin = (...args) => {
|
||||
const { BundleAnalyzerPlugin } = require('webpack-bundle-analyzer')
|
||||
return new BundleAnalyzerPlugin(...args)
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
mode: process.env.NODE_ENV,
|
||||
|
@ -265,20 +270,6 @@ module.exports = {
|
|||
},
|
||||
|
||||
plugins: [
|
||||
// return a non-zero exit code if there are any warnings so we don't continue compiling assets if webpack fails
|
||||
function () {
|
||||
this.plugin('done', ({compilation}) => {
|
||||
if (compilation.warnings && compilation.warnings.length) {
|
||||
console.error(compilation.warnings)
|
||||
// If there's a bad import, webpack doesn't say where.
|
||||
// Only if we let the compilation complete do we get
|
||||
// the callstack where the import happens
|
||||
// If you're having problems, comment out the following
|
||||
throw new Error('webpack build had warnings. Failing.')
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
// sets these environment variables in compiled code.
|
||||
// process.env.NODE_ENV will make it so react and others are much smaller and don't run their
|
||||
// debug/propType checking in prod.
|
||||
|
@ -313,8 +304,36 @@ module.exports = {
|
|||
// be removed when that issue is fixed
|
||||
new webpack.IgnorePlugin(/\.flow$/),
|
||||
|
||||
new CleanWebpackPlugin()
|
||||
new CleanWebpackPlugin(),
|
||||
].concat(
|
||||
// return a non-zero exit code if there are any warnings so we don't continue compiling assets if webpack fails
|
||||
process.env.WEBPACK_PEDANTIC !== '0' ? function () {
|
||||
this.plugin('done', ({compilation}) => {
|
||||
if (compilation.warnings && compilation.warnings.length) {
|
||||
console.error(compilation.warnings)
|
||||
// If there's a bad import, webpack doesn't say where.
|
||||
// Only if we let the compilation complete do we get
|
||||
// the callstack where the import happens
|
||||
// If you're having problems, comment out the following
|
||||
throw new Error('webpack build had warnings. Failing.')
|
||||
}
|
||||
})
|
||||
} : []
|
||||
).concat(
|
||||
process.env.WEBPACK_ANALYSIS === '1' ? createBundleAnalyzerPlugin({
|
||||
analyzerMode: 'static',
|
||||
reportFilename: process.env.WEBPACK_ANALYSIS_FILE ? (
|
||||
path.resolve(process.env.WEBPACK_ANALYSIS_FILE)
|
||||
) : (
|
||||
path.resolve(__dirname, '../tmp/webpack-bundle-analysis.html')
|
||||
),
|
||||
openAnalyzer: false,
|
||||
generateStatsFile: false,
|
||||
statsOptions: {
|
||||
source: false
|
||||
}
|
||||
}) : []
|
||||
).concat(
|
||||
process.env.NODE_ENV === 'test'
|
||||
? []
|
||||
: [
|
||||
|
|
|
@ -284,6 +284,7 @@
|
|||
"tinymce": "^5",
|
||||
"waait": "^1",
|
||||
"webpack": "^4",
|
||||
"webpack-bundle-analyzer": "^4.4.1",
|
||||
"webpack-cleanup-plugin": "^0.5",
|
||||
"webpack-cli": "^4",
|
||||
"webpack-manifest-plugin": "^2",
|
||||
|
@ -336,7 +337,7 @@
|
|||
"lint:style": "stylelint './app/**/*.{css,scss}' './packages/**/*.{css,scss}'",
|
||||
"lint:xss": "node ./script/xsslint.js",
|
||||
"postinstall": "yarn dedupe-yarn; test -n \"$DISABLE_POSTINSTALL\" || (yarn build:packages && ./script/install_hooks && ./script/fix_inst_esm.js)",
|
||||
"webpack:analyze": "echo 'if you get any errors here, make sure you have ran `rake canvas:compile_assets` first' && NODE_ENV=production SKIP_SOURCEMAPS=1 node --max_old_space_size=8096 $(yarn bin)/webpack --json > stats-prod.json && NODE_OPTIONS=\"--max_old_space_size=8192\" npx webpack-bundle-analyzer stats-prod.json public/dist/webpack-production",
|
||||
"webpack:analyze": "NODE_ENV=production NODE_OPTIONS=\"--max_old_space_size=8096\" SKIP_SOURCEMAPS=1 WEBPACK_ANALYSIS=1 WEBPACK_PEDANTIC=0 webpack",
|
||||
"webpack": "gulp rev 1> /dev/null & NODE_OPTIONS=\"--max_old_space_size=8192\" webpack --progress --color --watch",
|
||||
"webpack-development": "gulp rev 1> /dev/null & NODE_OPTIONS=\"--max_old_space_size=8192\" webpack --color",
|
||||
"webpack-production": "NODE_ENV=production gulp rev && NODE_ENV=production NODE_OPTIONS=\"--max_old_space_size=8192\" webpack --color",
|
||||
|
|
67
yarn.lock
67
yarn.lock
|
@ -4864,6 +4864,11 @@
|
|||
schema-utils "^2.6.5"
|
||||
source-map "^0.7.3"
|
||||
|
||||
"@polka/url@^1.0.0-next.9":
|
||||
version "1.0.0-next.12"
|
||||
resolved "https://registry.yarnpkg.com/@polka/url/-/url-1.0.0-next.12.tgz#431ec342a7195622f86688bbda82e3166ce8cb28"
|
||||
integrity sha512-6RglhutqrGFMO1MNUXp95RBuYIuc8wTnMAV5MUhLmjTOy78ncwOw7RgeQ/HeymkKXRhZd0s2DNrM1rL7unk3MQ==
|
||||
|
||||
"@popperjs/core@^2.5.4":
|
||||
version "2.6.0"
|
||||
resolved "https://registry.yarnpkg.com/@popperjs/core/-/core-2.6.0.tgz#f022195afdfc942e088ee2101285a1d31c7d727f"
|
||||
|
@ -6306,6 +6311,11 @@ acorn-walk@^7.0.0:
|
|||
resolved "https://registry.yarnpkg.com/acorn-walk/-/acorn-walk-7.2.0.tgz#0de889a601203909b0fbe07b8938dc21d2e967bc"
|
||||
integrity sha512-OPdCF6GsMIP+Az+aWfAAOEt2/+iVDKE7oy6lJ098aoe59oAmK76qV6Gw60SbZ8jHuG2wH058GF4pLFbYamYrVA==
|
||||
|
||||
acorn-walk@^8.0.0:
|
||||
version "8.1.0"
|
||||
resolved "https://registry.yarnpkg.com/acorn-walk/-/acorn-walk-8.1.0.tgz#d3c6a9faf00987a5e2b9bdb506c2aa76cd707f83"
|
||||
integrity sha512-mjmzmv12YIG/G8JQdQuz2MUDShEJ6teYpT5bmWA4q7iwoGen8xtt3twF3OvzIUl+Q06aWIjvnwQUKvQ6TtMRjg==
|
||||
|
||||
acorn@5.X, acorn@^5.0.3, acorn@^5.2.1, acorn@^5.5.0, acorn@^5.5.3:
|
||||
version "5.7.3"
|
||||
resolved "https://registry.yarnpkg.com/acorn/-/acorn-5.7.3.tgz#67aa231bf8812974b85235a96771eb6bd07ea279"
|
||||
|
@ -6336,6 +6346,11 @@ acorn@^7.1.0:
|
|||
resolved "https://registry.yarnpkg.com/acorn/-/acorn-7.1.0.tgz#949d36f2c292535da602283586c2477c57eb2d6c"
|
||||
integrity sha512-kL5CuoXA/dgxlBbVrflsflzQ3PAas7RYZB52NOm/6839iVYJgKMJ3cQJD+t2i5+qFa8h3MDpEOJiS64E8JLnSQ==
|
||||
|
||||
acorn@^8.0.4:
|
||||
version "8.2.4"
|
||||
resolved "https://registry.yarnpkg.com/acorn/-/acorn-8.2.4.tgz#caba24b08185c3b56e3168e97d15ed17f4d31fd0"
|
||||
integrity sha512-Ibt84YwBDDA890eDiDCEqcbwvHlBvzzDkU2cGBBDDI1QWT12jTiXIOn2CIw5KK4i6N5Z2HUxwYjzriDyqaqqZg==
|
||||
|
||||
address@1.1.2, address@^1.0.1:
|
||||
version "1.1.2"
|
||||
resolved "https://registry.yarnpkg.com/address/-/address-1.1.2.tgz#bf1116c9c758c51b7a933d296b72c221ed9428b6"
|
||||
|
@ -9766,6 +9781,11 @@ commander@^5.0.0:
|
|||
resolved "https://registry.yarnpkg.com/commander/-/commander-5.1.0.tgz#46abbd1652f8e059bddaef99bbdcb2ad9cf179ae"
|
||||
integrity sha512-P0CysNDQ7rtVw4QIQtm+MRxV66vKFSvlsQvGYXZWR3qFU0jlMKHZZZgw8e+8DSah4UDKMqnknRDQz+xuQXQ/Zg==
|
||||
|
||||
commander@^6.2.0:
|
||||
version "6.2.1"
|
||||
resolved "https://registry.yarnpkg.com/commander/-/commander-6.2.1.tgz#0792eb682dfbc325999bb2b84fddddba110ac73c"
|
||||
integrity sha512-U7VdrJFnJgo4xjrHpTzu0yrHPGImdsmD95ZlgYSEajAn2JKzDhDTPG9kBTefmObL2w/ngeZnilk+OV9CG3d7UA==
|
||||
|
||||
commander@^7.0.0:
|
||||
version "7.1.0"
|
||||
resolved "https://registry.yarnpkg.com/commander/-/commander-7.1.0.tgz#f2eaecf131f10e36e07d894698226e36ae0eb5ff"
|
||||
|
@ -11256,7 +11276,7 @@ downshift@^6.0.6:
|
|||
prop-types "^15.7.2"
|
||||
react-is "^17.0.1"
|
||||
|
||||
duplexer@^0.1.1:
|
||||
duplexer@^0.1.1, duplexer@^0.1.2:
|
||||
version "0.1.2"
|
||||
resolved "https://registry.yarnpkg.com/duplexer/-/duplexer-0.1.2.tgz#3abe43aef3835f8ae077d136ddce0f276b0400e6"
|
||||
integrity sha512-jtD6YG370ZCIi/9GTaJKQxWTZD045+4R4hTk/x1UyoqadyJ9x9CgSi1RlVDQF8U2sxLLSnFkCaMihqljHIWgMg==
|
||||
|
@ -14130,6 +14150,13 @@ gzip-size@5.1.1:
|
|||
duplexer "^0.1.1"
|
||||
pify "^4.0.1"
|
||||
|
||||
gzip-size@^6.0.0:
|
||||
version "6.0.0"
|
||||
resolved "https://registry.yarnpkg.com/gzip-size/-/gzip-size-6.0.0.tgz#065367fd50c239c0671cbcbad5be3e2eeb10e462"
|
||||
integrity sha512-ax7ZYomf6jqPTQ4+XCpUGyXKHk5WweS+e05MBO4/y3WJ5RkmPXNKvX+bx1behVILVwr6JSQvZAku021CHPXG3Q==
|
||||
dependencies:
|
||||
duplexer "^0.1.2"
|
||||
|
||||
handlebars@1.3.0:
|
||||
version "1.3.0"
|
||||
resolved "https://registry.yarnpkg.com/handlebars/-/handlebars-1.3.0.tgz#9e9b130a93e389491322d975cf3ec1818c37ce34"
|
||||
|
@ -17640,7 +17667,7 @@ lodash.uniq@4.5.0, lodash.uniq@^4.5.0:
|
|||
resolved "https://registry.yarnpkg.com/lodash.uniq/-/lodash.uniq-4.5.0.tgz#d0225373aeb652adc1bc82e4945339a842754773"
|
||||
integrity sha1-0CJTc662Uq3BvILklFM5qEJ1R3M=
|
||||
|
||||
"lodash@4.6.1 || ^4.16.1", "lodash@>=3.5 <5", lodash@>=4.17.4, lodash@^4, lodash@^4.0.0, lodash@^4.0.1, lodash@^4.10, lodash@^4.13.1, lodash@^4.14.0, lodash@^4.15.0, lodash@^4.16.4, lodash@^4.17.11, lodash@^4.17.13, lodash@^4.17.14, lodash@^4.17.15, lodash@^4.17.19, lodash@^4.17.3, lodash@^4.17.4, lodash@^4.17.5, lodash@^4.2.0, lodash@^4.2.1, lodash@^4.3.0, lodash@^4.5.0, lodash@~4.17.10:
|
||||
"lodash@4.6.1 || ^4.16.1", "lodash@>=3.5 <5", lodash@>=4.17.4, lodash@^4, lodash@^4.0.0, lodash@^4.0.1, lodash@^4.10, lodash@^4.13.1, lodash@^4.14.0, lodash@^4.15.0, lodash@^4.16.4, lodash@^4.17.11, lodash@^4.17.13, lodash@^4.17.14, lodash@^4.17.15, lodash@^4.17.19, lodash@^4.17.20, lodash@^4.17.3, lodash@^4.17.4, lodash@^4.17.5, lodash@^4.2.0, lodash@^4.2.1, lodash@^4.3.0, lodash@^4.5.0, lodash@~4.17.10:
|
||||
version "4.17.21"
|
||||
resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.21.tgz#679591c564c3bffaae8454cf0b3df370c3d6911c"
|
||||
integrity sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==
|
||||
|
@ -19374,6 +19401,11 @@ open@^7.0.2, open@^7.0.3:
|
|||
is-docker "^2.0.0"
|
||||
is-wsl "^2.1.1"
|
||||
|
||||
opener@^1.5.2:
|
||||
version "1.5.2"
|
||||
resolved "https://registry.yarnpkg.com/opener/-/opener-1.5.2.tgz#5d37e1f35077b9dcac4301372271afdeb2a13598"
|
||||
integrity sha512-ur5UIdyw5Y7yEj9wLzhqXiy6GZ3Mwx0yGI+5sMn2r0N0v3cKJvUmFH5yPP+WXh9e0xfyzyJX95D8l088DNFj7A==
|
||||
|
||||
optimism@^0.10.0:
|
||||
version "0.10.3"
|
||||
resolved "https://registry.yarnpkg.com/optimism/-/optimism-0.10.3.tgz#163268fdc741dea2fb50f300bedda80356445fd7"
|
||||
|
@ -23148,6 +23180,15 @@ sinon@^7, sinon@^7.4.2:
|
|||
nise "^1.5.2"
|
||||
supports-color "^5.5.0"
|
||||
|
||||
sirv@^1.0.7:
|
||||
version "1.0.11"
|
||||
resolved "https://registry.yarnpkg.com/sirv/-/sirv-1.0.11.tgz#81c19a29202048507d6ec0d8ba8910fda52eb5a4"
|
||||
integrity sha512-SR36i3/LSWja7AJNRBz4fF/Xjpn7lQFI30tZ434dIy+bitLYSP+ZEenHg36i23V2SGEz+kqjksg0uOGZ5LPiqg==
|
||||
dependencies:
|
||||
"@polka/url" "^1.0.0-next.9"
|
||||
mime "^2.3.1"
|
||||
totalist "^1.0.0"
|
||||
|
||||
sisteransi@^1.0.3:
|
||||
version "1.0.4"
|
||||
resolved "https://registry.yarnpkg.com/sisteransi/-/sisteransi-1.0.4.tgz#386713f1ef688c7c0304dc4c0632898941cad2e3"
|
||||
|
@ -24782,6 +24823,11 @@ toidentifier@1.0.0:
|
|||
resolved "https://registry.yarnpkg.com/toidentifier/-/toidentifier-1.0.0.tgz#7e1be3470f1e77948bc43d94a3c8f4d7752ba553"
|
||||
integrity sha512-yaOH/Pk/VEhBWWTlhI+qXxDFXlejDGcQipMlyxda9nthulaxLZUNcUqFxokp0vcYnvteJln5FNQDRrxj3YcbVw==
|
||||
|
||||
totalist@^1.0.0:
|
||||
version "1.1.0"
|
||||
resolved "https://registry.yarnpkg.com/totalist/-/totalist-1.1.0.tgz#a4d65a3e546517701e3e5c37a47a70ac97fe56df"
|
||||
integrity sha512-gduQwd1rOdDMGxFG1gEvhV88Oirdo2p+KjoYFU7k2g+i7n6AFFbDQ5kMPUsW0pNbfQsB/cwXvT1i4Bue0s9g5g==
|
||||
|
||||
tough-cookie@2.3.3:
|
||||
version "2.3.3"
|
||||
resolved "https://registry.yarnpkg.com/tough-cookie/-/tough-cookie-2.3.3.tgz#0b618a5565b6dea90bf3425d04d55edc475a7561"
|
||||
|
@ -25762,6 +25808,21 @@ webidl-conversions@^4.0.2:
|
|||
resolved "https://registry.yarnpkg.com/webidl-conversions/-/webidl-conversions-4.0.2.tgz#a855980b1f0b6b359ba1d5d9fb39ae941faa63ad"
|
||||
integrity sha512-YQ+BmxuTgd6UXZW3+ICGfyqRyHXVlD5GtQr5+qjiNW7bF0cqrzX500HVXPBOvgXb5YnzDd+h0zqyv61KUD7+Sg==
|
||||
|
||||
webpack-bundle-analyzer@^4.4.1:
|
||||
version "4.4.1"
|
||||
resolved "https://registry.yarnpkg.com/webpack-bundle-analyzer/-/webpack-bundle-analyzer-4.4.1.tgz#c71fb2eaffc10a4754d7303b224adb2342069da1"
|
||||
integrity sha512-j5m7WgytCkiVBoOGavzNokBOqxe6Mma13X1asfVYtKWM3wxBiRRu1u1iG0Iol5+qp9WgyhkMmBAcvjEfJ2bdDw==
|
||||
dependencies:
|
||||
acorn "^8.0.4"
|
||||
acorn-walk "^8.0.0"
|
||||
chalk "^4.1.0"
|
||||
commander "^6.2.0"
|
||||
gzip-size "^6.0.0"
|
||||
lodash "^4.17.20"
|
||||
opener "^1.5.2"
|
||||
sirv "^1.0.7"
|
||||
ws "^7.3.1"
|
||||
|
||||
webpack-cleanup-plugin@^0.5:
|
||||
version "0.5.1"
|
||||
resolved "https://registry.yarnpkg.com/webpack-cleanup-plugin/-/webpack-cleanup-plugin-0.5.1.tgz#df2d706bd75364c06e65b051186316d674eb96af"
|
||||
|
@ -26220,7 +26281,7 @@ ws@^6.1.2:
|
|||
dependencies:
|
||||
async-limiter "~1.0.0"
|
||||
|
||||
ws@^7.1.0:
|
||||
ws@^7.1.0, ws@^7.3.1:
|
||||
version "7.4.5"
|
||||
resolved "https://registry.yarnpkg.com/ws/-/ws-7.4.5.tgz#a484dd851e9beb6fdb420027e3885e8ce48986c1"
|
||||
integrity sha512-xzyu3hFvomRfXKH8vOFMU3OguG6oOvhXMo3xsGy3xWExqaM2dxBbVxuD99O7m3ZUFMvvscsZDqxfgMaRr/Nr1g==
|
||||
|
|
Loading…
Reference in New Issue