Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: updated devDependencies regarding webpack / to webpack version 5 & some cleanup #1301

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
171 commits
Select commit Hold shift + click to select a range
26db979
Merge pull request #1 from pattern-lab/dev
mfranzke Apr 24, 2020
7812878
Merge pull request #2 from pattern-lab/dev
mfranzke Apr 25, 2020
271dc8d
chore(docs): some typos
Apr 25, 2020
ccdf238
Revert "Merge pull request #2 from pattern-lab/dev"
Apr 25, 2020
4c2070f
Revert "Merge pull request #1 from pattern-lab/dev"
Apr 25, 2020
117ca22
Revert "chore(docs): some typos"
Apr 25, 2020
4f5bff6
Merge remote-tracking branch 'upstream/dev' into dev
Apr 28, 2020
73df9d3
Merge remote-tracking branch 'upstream/dev' into dev
Apr 30, 2020
9115c17
Merge remote-tracking branch 'upstream/dev' into dev
May 2, 2020
e86272f
Merge remote-tracking branch 'upstream/dev' into dev
May 8, 2020
a243f5d
Merge remote-tracking branch 'upstream/dev' into dev
May 11, 2020
3238ac7
Merge remote-tracking branch 'upstream/dev' into dev
May 23, 2020
7f4ba39
Merge remote-tracking branch 'upstream/dev' into dev
Jun 11, 2020
f7b514b
Merge remote-tracking branch 'upstream/dev' into dev
Jun 13, 2020
37f9749
Merge remote-tracking branch 'upstream/dev' into dev
Jun 28, 2020
572afec
Merge branch 'dev' of https://github.com/mfranzke/patternlab-node int…
Jun 28, 2020
e4a5245
Merge remote-tracking branch 'upstream/dev' into dev
Sep 6, 2020
4aa9366
Merge remote-tracking branch 'upstream/dev' into dev
Sep 11, 2020
155c253
Merge remote-tracking branch 'upstream/dev' into dev
Oct 11, 2020
3b95604
Merge remote-tracking branch 'upstream/dev' into dev
Jan 12, 2021
6b4a6fb
Merge remote-tracking branch 'upstream/dev' into dev
Feb 5, 2021
6431987
Merge remote-tracking branch 'upstream/dev' into dev
Feb 20, 2021
c511deb
refactor: removed obsolete dependencies
mfranzke Mar 15, 2021
18085d1
refactor: removed code out of obsolete dependency
mfranzke Mar 15, 2021
e1ca901
refactor: updated clean-css-loader related dependencies
mfranzke Mar 15, 2021
f268f44
refactor: updated clean-webpack-plugin dependency
mfranzke Mar 15, 2021
ced1d0f
refactor: updated webpack-merge dependency
mfranzke Mar 15, 2021
49f4f05
refactor: removed obsolete dependencies
mfranzke Mar 15, 2021
91ab7ac
refactor: updated html-webpack-plugin dependency
mfranzke Mar 15, 2021
85ad88c
refactor: updated node-sass-magic-importer dependency
mfranzke Mar 15, 2021
816f282
refactor: updated style-loader dependency
mfranzke Mar 15, 2021
be28fe1
refactor: updated svg-sprite-loader dependency
mfranzke Mar 15, 2021
c212302
refactor: updated svg-transform-loader dependency
mfranzke Mar 15, 2021
f31c500
refactor: updated svgo-loader dependency
mfranzke Mar 15, 2021
e4c459d
refactor: updated ts-loader dependency
mfranzke Mar 15, 2021
db74329
refactor: updated webpack-cli dependency
mfranzke Mar 15, 2021
37bd92f
refactor: updated copy-webpack-plugin dependency
mfranzke Mar 15, 2021
b29b513
refactor: updated webpack-dev-middleware dependency
mfranzke Mar 15, 2021
cb86722
refactor: updated mini-css-extract-plugin dependency
mfranzke Mar 15, 2021
16b1db2
refactor(webpackdevmiddleware): quiet has been removed a lot earlier …
mfranzke Mar 15, 2021
8c01830
refactor: updated no-emit-webpack-plugin dependency
mfranzke Mar 20, 2021
02697b9
refactor: updated webpack dependency
mfranzke Mar 20, 2021
c959186
refactor: rebuild yarn.lock file
mfranzke Mar 20, 2021
3a0c72d
refactor(terserplugin): options had an unknown property 'sourceMap'
mfranzke Mar 20, 2021
e619e63
refactor(webpack): clean up configuration
mfranzke Mar 20, 2021
8f347df
Merge branch 'dev' into refactor-updated-depencencies-webpack
mfranzke Mar 23, 2021
d486051
Merge remote-tracking branch 'upstream/dev' into dev
mfranzke Mar 23, 2021
cc5fb42
Merge branch 'dev' into refactor-updated-depencencies-webpack
mfranzke Mar 23, 2021
725d39e
Revert "Merge branch 'dev' into refactor-updated-depencencies-webpack"
mfranzke Mar 23, 2021
557f672
refactor(webpack): updated outdated options
mfranzke Mar 24, 2021
578f55d
refactor(webpack): updated outdated options
mfranzke Mar 24, 2021
be17657
Merge remote-tracking branch 'upstream/dev' into dev
mfranzke Mar 24, 2021
5efac54
Merge branch 'dev' into refactor-updated-depencencies-webpack
mfranzke Mar 24, 2021
e060fab
refactor: regenerated yarn.lock
mfranzke Mar 24, 2021
088ac19
refactor: updated babel-loader dependency
mfranzke Mar 25, 2021
4a78052
refactor: updated svg-sprite-loader dependency
mfranzke Mar 25, 2021
303e459
refactor: updated css-loader dependency
mfranzke Mar 25, 2021
21c3fd1
refactor: updated postcss-loader dependency
mfranzke Mar 25, 2021
3c8a52f
refactor(postcss-loader): added postcss dependency
mfranzke Mar 25, 2021
2949524
refactor: updated autoprefixer dependency
mfranzke Mar 25, 2021
a4221dc
refactor: updated copy-webpack-plugin dependency
mfranzke Mar 25, 2021
0ba3d33
refactor: updated webpack dependency
mfranzke Mar 25, 2021
d26515e
refactor: updated webpackbar dependency
mfranzke Mar 25, 2021
f834fd8
Merge branch 'dev' into refactor-updated-depencencies-webpack
mfranzke Mar 26, 2021
21df193
refactor: regenerated yarn.lock file
mfranzke Mar 26, 2021
d73b15c
Merge branch 'dev' into refactor-updated-depencencies-webpack
mfranzke Mar 26, 2021
6c18bdc
Merge remote-tracking branch 'upstream/dev' into dev
mfranzke Mar 26, 2021
17f768b
refactor: regenerated yarn.lock file
mfranzke Mar 26, 2021
5d200de
refactor(prettier): code rework on the prettier feedback
mfranzke Mar 26, 2021
63d946f
refactor(prettier): code rework on the prettier feedback
mfranzke Mar 26, 2021
3a13ee9
Merge branch 'dev' into refactor-updated-depencencies-webpack
mfranzke Mar 28, 2021
7f588be
build: regenerated yarn.lock file
mfranzke Mar 28, 2021
bcc18c2
Merge branch 'dev' into refactor-updated-depencencies-webpack
mfranzke Mar 28, 2021
46eb7dc
Merge remote-tracking branch 'upstream/dev' into dev
mfranzke Mar 29, 2021
6ef0c47
refactor: updated webpack-cli dependency
mfranzke Apr 3, 2021
cc6d4e7
refactor: updated webpack dependency
mfranzke Apr 3, 2021
9672c48
chore: removed unnecessary require entries
mfranzke Apr 3, 2021
ccf6277
build(webpack): 'stats' is the new 'display'
mfranzke Apr 3, 2021
ce0dedd
Merge remote-tracking branch 'upstream/dev' into dev
mfranzke Apr 18, 2021
e301bf7
Merge branch 'dev' into refactor-updated-depencencies-webpack
mfranzke Apr 18, 2021
1d0bec7
build: regenerated package-lock.json file
mfranzke Apr 18, 2021
093499b
Merge branch 'dev' into refactor-updated-depencencies-webpack
mfranzke May 17, 2021
e536cb2
Merge remote-tracking branch 'upstream/dev' into dev
mfranzke May 17, 2021
c76c714
Merge branch 'dev' into refactor-updated-depencencies-webpack
mfranzke May 19, 2021
a9e5080
Merge branch 'dev' into refactor-updated-depencencies-webpack
mfranzke Jun 9, 2021
cf5f5b7
Merge branch 'dev' into refactor-updated-depencencies-webpack
mfranzke Jun 12, 2021
9b60cf2
Merge remote-tracking branch 'upstream/dev' into dev
mfranzke Aug 30, 2021
d06012a
Revert "refactor: updated no-emit-webpack-plugin dependency"
mfranzke Sep 12, 2021
51c1d00
Merge remote-tracking branch 'upstream/dev' into dev
mfranzke Oct 3, 2021
4617540
Merge remote-tracking branch 'upstream/dev' into dev
mfranzke Oct 5, 2021
e3524db
Merge remote-tracking branch 'upstream/dev' into dev
mfranzke Oct 6, 2021
0342459
Merge branch 'dev' into refactor-updated-depencencies-webpack
mfranzke Oct 7, 2021
438f6c8
build: regenerated yarn.lock file
mfranzke Oct 7, 2021
20d3573
Merge remote-tracking branch 'upstream/dev' into dev
mfranzke Oct 16, 2021
47d0fad
Merge remote-tracking branch 'upstream/dev' into dev
mfranzke Nov 3, 2021
fbf5f46
Merge remote-tracking branch 'upstream/dev' into dev
mfranzke Nov 10, 2021
8f5efed
Merge branch 'dev' into refactor-updated-depencencies-webpack
mfranzke Nov 13, 2021
901183d
chore: reverted node-sass-selector-importer update
mfranzke Nov 13, 2021
c531071
refactor: updated sass-loader dependency
mfranzke Nov 14, 2021
da469b9
Merge remote-tracking branch 'upstream/dev' into dev
mfranzke Nov 21, 2021
82a52f0
Merge remote-tracking branch 'upstream/dev' into dev
mfranzke Nov 21, 2021
8249a87
Merge remote-tracking branch 'upstream/dev' into dev
mfranzke Nov 22, 2021
ad1ac28
chore: code optimizations
mfranzke Nov 23, 2021
fad1b6b
Merge branch 'dev' into refactor-updated-depencencies-webpack
mfranzke Nov 24, 2021
f7f072a
Merge branch 'dev' into refactor-updated-depencencies-webpack
mfranzke Nov 24, 2021
62653ec
chore: rebuild yarn.lock file
mfranzke Nov 24, 2021
d6d7994
Merge remote-tracking branch 'upstream/dev' into refactor-updated-dep…
mfranzke Dec 14, 2021
e2b9c0e
build: regenerated yarn.lock
mfranzke Dec 14, 2021
d124ed7
Merge remote-tracking branch 'upstream/dev' into refactor-updated-dep…
mfranzke Jan 29, 2022
0822ab4
build: regenerated yarn.lock file
mfranzke Jan 29, 2022
6e1da0b
Merge branch 'dev' into refactor-updated-depencencies-webpack
mfranzke Jan 30, 2022
e9c8f1d
Merge branch 'dev' into refactor-updated-depencencies-webpack
JosefBredereck Sep 21, 2022
41d3335
Merge branch 'dev' into refactor-updated-depencencies-webpack
mfranzke Dec 22, 2022
cf8ce41
refactor: updated clean-webpack-plugin
mfranzke Dec 22, 2022
a72947d
refactor: updated copy-webpack-plugin
mfranzke Dec 22, 2022
83eee65
refactor: updated html-webpack-plugin
mfranzke Dec 22, 2022
f13c764
refactor: updated webpack
mfranzke Dec 22, 2022
42258ac
refactor: updated webpack-cli
mfranzke Dec 22, 2022
670a726
refactor: updated webpack-dev-middleware
mfranzke Dec 22, 2022
defe59b
refactor: updated webpack-hot-middleware
mfranzke Dec 22, 2022
dbc95bb
refactor: updated webpack-merge
mfranzke Dec 22, 2022
36a6eec
refactor: updated webpackbar
mfranzke Dec 22, 2022
e788352
refactor: updated mini-css-extract-plugin
mfranzke Dec 22, 2022
68761cd
refactor: updated babel-loader
mfranzke Dec 22, 2022
efcded7
refactor: updating clean-css-loader
mfranzke Dec 22, 2022
74bc7c4
refactor: updated css-loader
mfranzke Dec 22, 2022
46fbd55
refactor: updated postcss-loader
mfranzke Dec 22, 2022
07c5cd7
refactor: updated sass-loader
mfranzke Dec 22, 2022
34e1598
refactor: updated style-loader
mfranzke Dec 22, 2022
63b4e97
refactor: updated svg-sprite-loader
mfranzke Dec 22, 2022
a01f444
refactor: updated svgo-loader
mfranzke Dec 22, 2022
e96594e
refactor: updates ts-loader
mfranzke Dec 22, 2022
be59096
chore: updated html-loader
mfranzke Dec 23, 2022
c0474f1
refactor: minimize on productive build is the new default
mfranzke Dec 23, 2022
b677703
refactor(webpack): we need to ignore those references
mfranzke Dec 23, 2022
35e13c6
refactor(html-loader): interpolate option got removed
mfranzke Dec 23, 2022
4df4777
fix(copy-webpack-plugin): correcting the path
mfranzke Dec 23, 2022
fb08a04
refactor: two of the options are now subitems of minimize
mfranzke Dec 23, 2022
434431a
chore: this attribute doesn't exist (any more)
mfranzke Dec 23, 2022
02db942
Restore packages/core/test/files/_handlebars-test-patterns/atoms/glob…
mfranzke Dec 26, 2022
c737c5e
Restore packages/core/test/lineage_hunter_tests.js
mfranzke Dec 26, 2022
25fc396
Restore packages/development-edition-engine-react/source/_meta/_head.…
mfranzke Dec 26, 2022
562252a
Restore packages/core/test/pattern_engines_tests.js
mfranzke Dec 26, 2022
8dcb4bd
Restore packages/core/test/pseudopattern_hunter_tests.js
mfranzke Dec 26, 2022
5816747
Restore packages/engine-handlebars/lib/engine_handlebars.js
mfranzke Dec 26, 2022
f24d0e9
Restore packages/engine-nunjucks/lib/engine_nunjucks.js
mfranzke Dec 26, 2022
b3003ee
Restore packages/engine-twig-php/lib/engine_twig_php.js
mfranzke Dec 26, 2022
834ef9a
Restore packages/engine-underscore/_meta/_head.html
mfranzke Dec 26, 2022
9dd3d47
Restore packages/engine-underscore/lib/engine_underscore.js
mfranzke Dec 26, 2022
005c7f6
Restore packages/uikit-workshop/src/scripts/actions/app.js
mfranzke Dec 26, 2022
fc42029
Merge branch 'dev' into refactor-updated-depencencies-webpack
mfranzke Dec 27, 2022
4bed19f
Merge remote-tracking branch 'upstream/dev' into refactor-updated-dep…
mfranzke Dec 28, 2022
776b0ff
chore: regenerated yarn.lock
mfranzke Dec 28, 2022
eb9e761
Merge branch 'dev' into refactor-updated-depencencies-webpack
mfranzke Dec 29, 2022
b63681a
chore: corrected package.json
mfranzke Dec 29, 2022
ec18ed6
fix: we need to import the cjs from handlebars directly
mfranzke Dec 29, 2022
983b33b
Merge branch 'dev' into refactor-updated-depencencies-webpack
mfranzke Dec 29, 2022
d03c90b
Merge branch 'dev' into refactor-updated-depencencies-webpack
mfranzke Dec 30, 2022
26ed0d1
Merge branch 'dev' into refactor-updated-depencencies-webpack
mfranzke Jan 4, 2023
4781d95
Update webpack.config.js
mfranzke Jan 4, 2023
b41284d
Update webpack.config.js
mfranzke Jan 4, 2023
031cf2f
Update webpack.config.js
mfranzke Jan 4, 2023
714602d
Update webpack.config.js
mfranzke Jan 4, 2023
692dbc4
Merge remote-tracking branch 'upstream/dev' into refactor-updated-dep…
mfranzke Jan 8, 2023
a01a929
chore: regenerated yarn.lock
mfranzke Jan 8, 2023
2fd8115
Merge branch 'dev' into refactor-updated-depencencies-webpack
mfranzke Jan 9, 2023
9c38ab4
Merge branch 'dev' into refactor-updated-depencencies-webpack
mfranzke Jan 14, 2023
beeb9de
Merge branch 'dev' into refactor-updated-depencencies-webpack
mfranzke Jan 29, 2023
017b026
refactor: updated babel-loader dependency again
mfranzke Jan 29, 2023
91a63d0
refactor: updated clean-css-loader dependency again
mfranzke Jan 29, 2023
199d803
refactor: updated svgo-loader dependency again
mfranzke Jan 29, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions packages/uikit-workshop/build/webpack-server.js
Original file line number Diff line number Diff line change
Expand Up @@ -120,10 +120,8 @@ async function serve(patternlab, configPath, buildDir = 'public') {

app.use(
webpackDevMiddleware(compiler, {
quiet: true,
stats: 'errors-warnings',
writeToDisk: true,
logLevel: 'error',
})
);

Expand Down
50 changes: 25 additions & 25 deletions packages/uikit-workshop/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
"start": "node ./build-tools.js",
"prepublish": "npm run build",
"postbootstrap": "npm run build",
"build": "webpack-cli --config webpack.config.js --progress --bail --display=minimal",
"watch": "webpack-cli --config webpack.config.js --progress --watch --display=minimal",
"build": "webpack-cli --config webpack.config.js --progress --bail --stats=minimal",
"watch": "webpack-cli --config webpack.config.js --progress --watch --stats=minimal",
"test": "npm run build"
},
"authors": [
Expand Down Expand Up @@ -48,32 +48,32 @@
"@pattern-lab/uikit-polyfills": "^5.16.1",
"@reach/visually-hidden": "^0.1.2",
"@webcomponents/custom-elements": "^1.4.3",
"autoprefixer": "^9.6.5",
"babel-loader": "^8.0.6",
"autoprefixer": "^10.2.5",
"babel-loader": "^9.1.2",
"better-opn": "^3.0.0",
"browser-sync": "^2.26.7",
"classnames": "^2.3.1",
"clean-css-loader": "^1.0.1",
"clean-webpack-plugin": "0.1.19",
"clean-css-loader": "^4.2.1",
"clean-webpack-plugin": "4.0.0",
"clipboard": "^2.0.8",
"copy-webpack-plugin": "^5.0.2",
"copy-webpack-plugin": "^11.0.0",
"cosmiconfig": "^7.0.0",
"css-loader": "^3.2.0",
"css-loader": "^6.7.3",
"ejs": "^3.1.6",
"express": "^4.17.1",
"fg-loadjs": "^1.1.0",
"fuse.js": "^6.4.6",
"handlebars": "^4.7.7",
"hard-source-webpack-plugin-patch": "^0.13.3",
"hasha": "^5.2.2",
"html-loader": "^0.5.5",
"html-webpack-plugin": "^4.0.0-beta.11",
"html-loader": "^4.2.0",
"html-webpack-plugin": "^5.5.0",
"lit-element": "^2.2.1",
"lit-html": "^1.1.2",
"mini-css-extract-plugin": "^0.8.0",
"mini-css-extract-plugin": "^2.7.2",
"mousetrap": "^1.6.5",
"portfinder": "^1.0.28",
"postcss-loader": "^3.0.0",
"postcss": "^8.2.8",
"postcss-loader": "^7.0.2",
"preact-render-to-string": "^5.1.1",
"preact": "^10.0.5",
"preload-webpack-plugin": "^3.0.0-beta.3",
Expand All @@ -86,21 +86,21 @@
"redux": "4.1.2",
"redux-thunk": "^2.4.0",
"sass": "1.43.4",
"sass-loader": "^10.1.1",
"sass-loader": "^13.2.0",
"scriptjs": "^2.5.9",
"scroll-js": "3.4.x",
"skatejs": "^5.2.4",
"style-loader": "^1.0.0",
"svg-sprite-loader": "^4.1.6",
"svg-transform-loader": "^2.0.8",
"svgo-loader": "^3.0.0",
"ts-loader": "^6.2.1",
"webpack": "^4.41.2",
"webpack-cli": "^3.3.9",
"webpack-dev-middleware": "^3.7.2",
"webpack-hot-middleware": "^2.25.0",
"webpack-merge": "^4.2.2",
"webpackbar": "^4.0.0",
"style-loader": "^3.3.1",
"svg-sprite-loader": "^6.0.11",
"svg-transform-loader": "^2.0.13",
"svgo-loader": "^4.0.0",
"ts-loader": "^9.4.2",
"webpack": "^5.75.0",
"webpack-cli": "^5.0.1",
"webpack-dev-middleware": "^6.0.1",
"webpack-hot-middleware": "^2.25.3",
"webpack-merge": "^5.8.0",
"webpackbar": "5.0.2",
"wolfy87-eventemitter": "^5.2.9",
"yargs": "^17.0.1"
},
Expand Down
9 changes: 8 additions & 1 deletion packages/uikit-workshop/src/html/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,16 @@
content="initial-scale=1, width=device-width, viewport-fit=cover"
/>
<meta name="theme-color" content="#ababab" />
<!-- webpackIgnore: true -->
<link rel="stylesheet" href="styleguide/css/pattern-lab.css" media="all" />

<!-- webpackIgnore: true -->
<link
rel="prefetch"
as="image"
href="styleguide/images/pattern-lab-logo--on-dark.svg"
/>
<!-- webpackIgnore: true -->
<link
rel="prefetch"
as="image"
Expand All @@ -28,11 +31,14 @@
<!-- the template for the modal slider -->
<!-- prettier-ignore -->
<script type="text/x-handlebars-template" class="pl-js-panel-template-base">
${require('./partials/base-template.html') }
<include src="partials/base-template.html"/>
</script>

<!-- webpackIgnore: true -->
<script src="styleguide/data/patternlab-data.js" defer></script>
<!-- webpackIgnore: true -->
<script src="annotations/annotations.js" defer></script>
<!-- webpackIgnore: true -->
<script
src="styleguide/js/patternlab-viewer.modern.js"
type="module"
Expand Down Expand Up @@ -63,6 +69,7 @@
}
})();
</script>
<!-- webpackIgnore: true -->
<script
src="styleguide/js/patternlab-viewer.js"
defer
Expand Down
86 changes: 39 additions & 47 deletions packages/uikit-workshop/webpack.config.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,14 @@
// webpack.config.js
const CleanWebpackPlugin = require('clean-webpack-plugin');
const HardSourceWebpackPlugin = require('hard-source-webpack-plugin-patch');
const { CleanWebpackPlugin } = require('clean-webpack-plugin');
const TerserPlugin = require('terser-webpack-plugin');
const autoprefixer = require('autoprefixer');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
const webpack = require('webpack');
const CopyPlugin = require('copy-webpack-plugin');
const path = require('path');
const argv = require('yargs').argv;
const merge = require('webpack-merge');
const { merge } = require('webpack-merge');
const WebpackBar = require('webpackbar');
const fs = require('node:fs');

const cosmiconfigSync = require('cosmiconfig').cosmiconfigSync;
const explorerSync = cosmiconfigSync('patternlab');
Expand All @@ -23,10 +21,27 @@ const defaultConfig = {
sourceMaps: true,
watch: argv.watch ? true : false,
publicPath: './styleguide/',
copy: [{ from: './src/images/**', to: 'images', flatten: true }],
copy: {
patterns: [
{ from: '../uikit-workshop/src/images/**', to: 'images/[name][ext]' },
],
},
noViewAll: false,
};

// Requiring partials
// adapted from https://github.com/webpack-contrib/html-loader/issues/291#issuecomment-721909576
const INCLUDE_PATTERN = /\<include src=\"(.+)\"\/?\>(?:\<\/include\>)?/gi;
const processNestedHtml = (content, loaderContext) =>
!INCLUDE_PATTERN.test(content)
? content
: content.replace(INCLUDE_PATTERN, (m, src) =>
processNestedHtml(
fs.readFileSync(path.resolve(loaderContext.context, src), 'utf8'),
loaderContext
)
);

module.exports = function (apiConfig) {
return new Promise(async (resolve) => {
let customConfig = defaultConfig;
Expand Down Expand Up @@ -109,7 +124,9 @@ module.exports = function (apiConfig) {
loader: 'postcss-loader',
options: {
sourceMap: config.sourceMaps,
plugins: () => [autoprefixer()],
postcssOptions: {
plugins: [['autoprefixer', {}]],
},
},
},
{
Expand Down Expand Up @@ -147,7 +164,6 @@ module.exports = function (apiConfig) {
output: {
path: path.resolve(config.rootDir, `${config.buildDir}/styleguide`),
publicPath: `${config.publicPath}`,
filename: '[name].js',
chunkFilename: `js/[name]-chunk-[chunkhash].js`,
},
module: {
Expand All @@ -170,12 +186,11 @@ module.exports = function (apiConfig) {
{
loader: 'html-loader',
options: {
interpolate: true,
minimize: config.prod ? true : false,
minifyCSS: false,
minifyJS: config.prod ? true : false,
// super important -- this prevents the embedded iframe srcdoc HTML from breaking!
preventAttributesEscaping: true,
minimize: {
minifyCSS: false,
minifyJS: config.prod ? true : false,
},
preprocessor: processNestedHtml,
},
},
],
Expand Down Expand Up @@ -225,8 +240,8 @@ module.exports = function (apiConfig) {
mode: config.prod ? 'production' : 'development',
optimization: {
minimize: config.prod,
occurrenceOrder: true,
namedChunks: true,
chunkIds: 'total-size',
moduleIds: 'size',
removeAvailableModules: true,
removeEmptyChunks: true,
nodeEnv: 'production',
Expand All @@ -235,9 +250,9 @@ module.exports = function (apiConfig) {
splitChunks: {
chunks: 'async',
cacheGroups: {
vendors: {
defaultVendors: {
test: /[\\/]node_modules[\\/]/,
name: 'vendors',
idHint: 'vendors',
chunks: 'async',
reuseExistingChunk: true,
},
Expand All @@ -247,7 +262,6 @@ module.exports = function (apiConfig) {
? [
new TerserPlugin({
test: /\.m?js(\?.*)?$/i,
sourceMap: config.prod ? false : config.sourceMaps,
terserOptions: {
safari10: true,
},
Expand All @@ -258,23 +272,6 @@ module.exports = function (apiConfig) {
plugins: [new WebpackBar(), new CopyPlugin(config.copy)],
};

webpackConfig.plugins.push(
new HardSourceWebpackPlugin({
info: {
level: 'warn',
},
// Clean up large, old caches automatically.
cachePrune: {
// Caches younger than `maxAge` are not considered for deletion. They must
// be at least this (default: 2 days) old in milliseconds.
maxAge: 2 * 24 * 60 * 60 * 1000,
// All caches together must be larger than `sizeThreshold` before any
// caches will be deleted. Together they must be at least 300MB in size
sizeThreshold: 300 * 1024 * 1024,
},
})
);

const legacyConfig = merge(webpackConfig, {
entry: {
'js/patternlab-pattern': path.join(
Expand Down Expand Up @@ -303,7 +300,6 @@ module.exports = function (apiConfig) {
new MiniCssExtractPlugin({
filename: `[name].css`,
chunkFilename: `[id].css`,
allChunks: true,
mfranzke marked this conversation as resolved.
Show resolved Hide resolved
}),
],
});
Expand Down Expand Up @@ -343,22 +339,19 @@ module.exports = function (apiConfig) {
},
plugins: [
// clear out the buildDir on every fresh Webpack build
new CleanWebpackPlugin(
config.watch
new CleanWebpackPlugin({
verbose: false,
cleanOnceBeforeBuildPatterns: config.watch
? []
: [
`${config.buildDir}/index.html`,
`${config.buildDir}/styleguide/css`,
`${config.buildDir}/styleguide/js`,
],
{
allowExternal: true,
mfranzke marked this conversation as resolved.
Show resolved Hide resolved
verbose: false,

// perform clean just before files are emitted to the output dir
beforeEmit: false,
}
),
// perform clean just before files are emitted to the output dir
beforeEmit: false,
}),
new HtmlWebpackPlugin({
filename: '../index.html',
template: path.resolve(__dirname, 'src/html/index.html'),
Expand All @@ -367,7 +360,6 @@ module.exports = function (apiConfig) {
new MiniCssExtractPlugin({
filename: `[name].css`,
chunkFilename: `[id].css`,
allChunks: true,
mfranzke marked this conversation as resolved.
Show resolved Hide resolved
}),
],
});
Expand Down
Loading