Webpack 5 update + minor fixtures

This commit is contained in:
Tony Air 2020-12-28 06:29:43 +07:00
parent 5ddda5d91f
commit 850704705f
13 changed files with 116 additions and 115 deletions

View File

@ -7,7 +7,7 @@ After:
SilverStripe\Core\Injector\Injector: SilverStripe\Core\Injector\Injector:
A2nt\SilverStripeMapboxField\MarkerExtension: A2nt\SilverStripeMapboxField\MarkerExtension:
properties: properties:
geocoder: %$Symbiote\Addressable\MapboxGeocodeService geocoder: '%$Symbiote\Addressable\MapboxGeocodeService'
Symbiote\Addressable\GeocodeServiceInterface: Symbiote\Addressable\GeocodeServiceInterface:
class: Symbiote\Addressable\MapboxGeocodeService class: Symbiote\Addressable\MapboxGeocodeService

View File

@ -33,7 +33,7 @@ SilverStripe\Core\Injector\Injector:
SilverStripe\Assets\Storage\GeneratedAssetHandler.custom-generated-assets: SilverStripe\Assets\Storage\GeneratedAssetHandler.custom-generated-assets:
class: SilverStripe\Assets\Flysystem\GeneratedAssets class: SilverStripe\Assets\Flysystem\GeneratedAssets
properties: properties:
Filesystem: %$League\Flysystem\Filesystem.custom-filesystem Filesystem: '%$League\Flysystem\Filesystem.custom-filesystem'
# Assign this generator to the requirements builder # Assign this generator to the requirements builder
SilverStripe\View\Requirements_Backend: SilverStripe\View\Requirements_Backend:
properties: properties:

View File

@ -24,6 +24,7 @@ class Notification extends DataObject
'Content' => 'Text', 'Content' => 'Text',
'DateOn' => 'Date', 'DateOn' => 'Date',
'DateOff' => 'Date', 'DateOff' => 'Date',
'Area' => 'Enum("Site","Site")',
]; ];
private static $has_one = [ private static $has_one = [

View File

@ -42,7 +42,6 @@
"a2nt/silverstripe-mapboxfield": "dev-master", "a2nt/silverstripe-mapboxfield": "dev-master",
"a2nt/silverstripe-progressivewebapp": "dev-master", "a2nt/silverstripe-progressivewebapp": "dev-master",
"bummzack/sortablefile": "*", "bummzack/sortablefile": "*",
"barryvdh/composer-cleanup-plugin": "0.2.x",
"eluceo/ical": "^0.16.0", "eluceo/ical": "^0.16.0",
"ezyang/htmlpurifier": "^4.13", "ezyang/htmlpurifier": "^4.13",
"showpro/silverstripe-seo-images": "^1.0", "showpro/silverstripe-seo-images": "^1.0",
@ -70,6 +69,7 @@
"project-files-installed": [ "project-files-installed": [
"app/.htaccess", "app/.htaccess",
"app/_config.php", "app/_config.php",
"app/_config/database.yml",
"app/_config/mimevalidator.yml", "app/_config/mimevalidator.yml",
"app/_config/mysite.yml", "app/_config/mysite.yml",
"app/src/Page.php", "app/src/Page.php",

View File

@ -13,10 +13,10 @@
"yarn": ">= 1.0.0" "yarn": ">= 1.0.0"
}, },
"scripts": { "scripts": {
"start": "cross-env NODE_ENV=development webpack-dev-server --https -d --config webpack.config.dev.js", "start": "cross-env NODE_ENV=development webpack-dev-server --https --config webpack.config.serve.js",
"dash": "cross-env NODE_ENV=development webpack-dashboard -- webpack-dev-server --config webpack.config.dev.js", "dash": "cross-env NODE_ENV=development webpack-dashboard -- webpack-dev-server --config webpack.config.serve.js",
"prebuild": "rimraf app/client/dist", "prebuild": "rimraf ./app/client/dist",
"build": "cross-env NODE_ENV=production webpack -p --config webpack.config.prod.js --progress", "build": "cross-env NODE_ENV=production webpack --progress --stats-all",
"lint:check": "eslint ./app/client/src --config .eslintrc && sass-lint ./app/client/src --config .sasslintrc -v -q", "lint:check": "eslint ./app/client/src --config .eslintrc && sass-lint ./app/client/src --config .sasslintrc -v -q",
"lint:fix": "eslint ./app/client/src --config .eslintrc --fix && sass-lint ./app/client/src --config .sasslintrc -v -q --fix", "lint:fix": "eslint ./app/client/src --config .eslintrc --fix && sass-lint ./app/client/src --config .sasslintrc -v -q --fix",
"lint:js": "eslint ./app/client/src --config .eslintrc", "lint:js": "eslint ./app/client/src --config .eslintrc",
@ -31,8 +31,8 @@
"ie>=11" "ie>=11"
], ],
"dependencies": { "dependencies": {
"@a2nt/meta-lightbox": "^2.7.1", "@a2nt/meta-lightbox": "^2.4.0",
"@a2nt/ss-bootstrap-ui-webpack-boilerplate": "^2.7.0", "@a2nt/ss-bootstrap-ui-webpack-boilerplate": "^2.6.3",
"aos": "^2.3.4", "aos": "^2.3.4",
"bootbox": "^5.5.2", "bootbox": "^5.5.2",
"bootstrap": "^4.5.3", "bootstrap": "^4.5.3",
@ -92,18 +92,14 @@
"favicons-webpack-plugin": "^4.2.0", "favicons-webpack-plugin": "^4.2.0",
"file-loader": "^6.2.0", "file-loader": "^6.2.0",
"font-awesome": "^4.7.0", "font-awesome": "^4.7.0",
"hard-source-webpack-plugin": "^0.13.1",
"hoist-non-react-statics": "^3.3.2", "hoist-non-react-statics": "^3.3.2",
"html-entities": "^1.4.0", "html-entities": "^1.4.0",
"html-webpack-plugin": "^4.5.0", "html-webpack-plugin": "^4.5.0",
"imagemin-gifsicle": "^7.0.0", "image-minimizer-webpack-plugin": "^2.1.0",
"imagemin-jpegtran": "^7.0.0", "imagemin-jpegtran": "^7.0.0",
"imagemin-optipng": "^8.0.0",
"imagemin-svgo": "^8.0.0",
"imagemin-webp": "^6.0.0",
"img-optimize-loader": "^1.0.7", "img-optimize-loader": "^1.0.7",
"loglevel": "^1.7.1", "loglevel": "^1.7.1",
"mini-css-extract-plugin": "^0.12.0", "mini-css-extract-plugin": "^1.3.3",
"node-sass": "^5.0.0", "node-sass": "^5.0.0",
"object-assign": "^4.1.1", "object-assign": "^4.1.1",
"optimize-css-assets-webpack-plugin": "^5.0.4", "optimize-css-assets-webpack-plugin": "^5.0.4",
@ -127,12 +123,12 @@
"strip-ansi": "^6.0.0", "strip-ansi": "^6.0.0",
"style-loader": "^2.0.0", "style-loader": "^2.0.0",
"svg-url-loader": "^7.1.1", "svg-url-loader": "^7.1.1",
"terser-webpack-plugin": "^4.2.3", "terser-webpack-plugin": "^5.0.3",
"url-loader": "^4.1.1", "url-loader": "^4.1.1",
"webpack": "^4.44.2", "webpack": "^5.11.0",
"webpack-cli": "^3.3.12", "webpack-cli": "^4.2.0",
"webpack-dev-server": "^3.11.0", "webpack-dev-server": "^4.0.0-beta.0",
"webpack-manifest-plugin": "^2.2.0", "webpack-manifest-plugin": "^3.0.0",
"webpack-merge": "^5.7.3" "webpack-merge": "^5.7.3"
}, },
"stylelint": { "stylelint": {

View File

@ -1,22 +1,19 @@
/* /*
* Common Environment * Common Environment
*/ */
const UIInfo = require('./node_modules/@a2nt/ss-bootstrap-ui-webpack-boilerplate/package.json');
console.log(
'UI: ' +
JSON.stringify(UIInfo.name) +
' ver: ' +
JSON.stringify(UIInfo.version),
);
const webpack = require('webpack'); const webpack = require('webpack');
const commonVariables = require('./webpack.configuration'); const commonVariables = require('./webpack.configuration');
const conf = commonVariables.configuration; const conf = commonVariables.configuration;
const HardSourceWebpackPlugin = require('hard-source-webpack-plugin');
const path = require('path'); const path = require('path');
const filesystem = require('fs'); const filesystem = require('fs');
const UIInfo = require('./node_modules/@a2nt/ss-bootstrap-ui-webpack-boilerplate/package.json');
const UINAME = JSON.stringify(UIInfo.name);
const UIVERSION = JSON.stringify(UIInfo.version);
console.info(`%cUI Kit ${UINAME} ${UIVERSION}`, 'color:yellow;font-size:14px');
const includes = {}; const includes = {};
const modules = [ const modules = [
path.resolve(__dirname, conf.APPDIR, 'client', 'src'), path.resolve(__dirname, conf.APPDIR, 'client', 'src'),
@ -104,81 +101,16 @@ commonVariables.themes.forEach((theme) => {
module.exports = { module.exports = {
entry: includes, entry: includes,
devtool: 'source-map',
externals: { externals: {
jquery: 'jQuery', jquery: 'jQuery',
}, },
optimization: {
namedModules: true, // NamedModulesPlugin()
splitChunks: {
// CommonsChunkPlugin()
name: 'vendor',
minChunks: 2,
},
noEmitOnErrors: true, // NoEmitOnErrorsPlugin
concatenateModules: true, //ModuleConcatenationPlugin
},
module: {
rules: [
{
test: /\.jsx?$/,
//exclude: /node_modules/,
use: {
loader: 'babel-loader',
options: {
presets: ['@babel/preset-env'], //Preset used for env setup
plugins: [
['@babel/transform-react-jsx'],
['react-hot-loader/babel'],
],
cacheDirectory: true,
cacheCompression: false,
},
},
},
/*{
test: /\.tsx?$/,
use: 'ts-loader',
exclude: /node_modules/,
},
{
test: /\.coffee?$/,
use: 'coffee-loader',
},*/
{
test: /\.worker\.js$/,
use: {
loader: 'worker-loader',
},
},
],
},
resolve: { resolve: {
modules: modules, modules: modules,
alias: { alias: {
'window.jQuery': require.resolve('jquery'),
$: require.resolve('jquery'),
jquery: require.resolve('jquery'), jquery: require.resolve('jquery'),
jQuery: require.resolve('jquery'), jQuery: require.resolve('jquery'),
}, },
}, },
plugins: [
new webpack.ProvidePlugin({
$: 'jquery',
jQuery: 'jquery',
'window.jQuery': 'jquery',
Popper: ['popper.js', 'default'],
Util: 'exports-loader?Util!bootstrap/js/dist/util',
Alert: 'exports-loader?Alert!bootstrap/js/dist/alert',
Button: 'exports-loader?Button!bootstrap/js/dist/button',
Carousel: 'exports-loader?Carousel!bootstrap/js/dist/carousel',
Collapse: 'exports-loader?Collapse!bootstrap/js/dist/collapse',
Dropdown: 'exports-loader?Dropdown!bootstrap/js/dist/dropdown',
Modal: 'exports-loader?Modal!bootstrap/js/dist/modal',
Tooltip: 'exports-loader?Tooltip!bootstrap/js/dist/tooltip',
Popover: 'exports-loader?Popover!bootstrap/js/dist/popover',
Scrollspy: 'exports-loader?Scrollspy!bootstrap/js/dist/scrollspy',
Tab: 'exports-loader?Tab!bootstrap/js/dist/tab',
}),
new HardSourceWebpackPlugin(),
],
}; };

View File

@ -13,10 +13,10 @@
"yarn": ">= 1.0.0" "yarn": ">= 1.0.0"
}, },
"scripts": { "scripts": {
"start": "cross-env NODE_ENV=development webpack-dev-server --https --config webpack.config.serve.js", "start": "cross-env NODE_ENV=development webpack-dev-server --https -d --config webpack.config.dev.js",
"dash": "cross-env NODE_ENV=development webpack-dashboard -- webpack-dev-server --config webpack.config.serve.js", "dash": "cross-env NODE_ENV=development webpack-dashboard -- webpack-dev-server --config webpack.config.dev.js",
"prebuild": "rimraf ./app/client/dist", "prebuild": "rimraf app/client/dist",
"build": "cross-env NODE_ENV=production webpack --progress --stats-all", "build": "cross-env NODE_ENV=production webpack -p --config webpack.config.prod.js --progress",
"lint:check": "eslint ./app/client/src --config .eslintrc && sass-lint ./app/client/src --config .sasslintrc -v -q", "lint:check": "eslint ./app/client/src --config .eslintrc && sass-lint ./app/client/src --config .sasslintrc -v -q",
"lint:fix": "eslint ./app/client/src --config .eslintrc --fix && sass-lint ./app/client/src --config .sasslintrc -v -q --fix", "lint:fix": "eslint ./app/client/src --config .eslintrc --fix && sass-lint ./app/client/src --config .sasslintrc -v -q --fix",
"lint:js": "eslint ./app/client/src --config .eslintrc", "lint:js": "eslint ./app/client/src --config .eslintrc",
@ -31,8 +31,8 @@
"ie>=11" "ie>=11"
], ],
"dependencies": { "dependencies": {
"@a2nt/meta-lightbox": "^2.4.0", "@a2nt/meta-lightbox": "^2.7.1",
"@a2nt/ss-bootstrap-ui-webpack-boilerplate": "^2.6.3", "@a2nt/ss-bootstrap-ui-webpack-boilerplate": "^2.7.0",
"aos": "^2.3.4", "aos": "^2.3.4",
"bootbox": "^5.5.2", "bootbox": "^5.5.2",
"bootstrap": "^4.5.3", "bootstrap": "^4.5.3",
@ -92,14 +92,18 @@
"favicons-webpack-plugin": "^4.2.0", "favicons-webpack-plugin": "^4.2.0",
"file-loader": "^6.2.0", "file-loader": "^6.2.0",
"font-awesome": "^4.7.0", "font-awesome": "^4.7.0",
"hard-source-webpack-plugin": "^0.13.1",
"hoist-non-react-statics": "^3.3.2", "hoist-non-react-statics": "^3.3.2",
"html-entities": "^1.4.0", "html-entities": "^1.4.0",
"html-webpack-plugin": "^4.5.0", "html-webpack-plugin": "^4.5.0",
"image-minimizer-webpack-plugin": "^2.1.0", "imagemin-gifsicle": "^7.0.0",
"imagemin-jpegtran": "^7.0.0", "imagemin-jpegtran": "^7.0.0",
"imagemin-optipng": "^8.0.0",
"imagemin-svgo": "^8.0.0",
"imagemin-webp": "^6.0.0",
"img-optimize-loader": "^1.0.7", "img-optimize-loader": "^1.0.7",
"loglevel": "^1.7.1", "loglevel": "^1.7.1",
"mini-css-extract-plugin": "^1.3.3", "mini-css-extract-plugin": "^0.12.0",
"node-sass": "^5.0.0", "node-sass": "^5.0.0",
"object-assign": "^4.1.1", "object-assign": "^4.1.1",
"optimize-css-assets-webpack-plugin": "^5.0.4", "optimize-css-assets-webpack-plugin": "^5.0.4",
@ -123,12 +127,12 @@
"strip-ansi": "^6.0.0", "strip-ansi": "^6.0.0",
"style-loader": "^2.0.0", "style-loader": "^2.0.0",
"svg-url-loader": "^7.1.1", "svg-url-loader": "^7.1.1",
"terser-webpack-plugin": "^5.0.3", "terser-webpack-plugin": "^4.2.3",
"url-loader": "^4.1.1", "url-loader": "^4.1.1",
"webpack": "^5.11.0", "webpack": "^4.44.2",
"webpack-cli": "^4.2.0", "webpack-cli": "^3.3.12",
"webpack-dev-server": "^4.0.0-beta.0", "webpack-dev-server": "^3.11.0",
"webpack-manifest-plugin": "^3.0.0", "webpack-manifest-plugin": "^2.2.0",
"webpack-merge": "^5.7.3" "webpack-merge": "^5.7.3"
}, },
"stylelint": { "stylelint": {

View File

@ -1,19 +1,22 @@
/* /*
* Common Environment * Common Environment
*/ */
const UIInfo = require('./node_modules/@a2nt/ss-bootstrap-ui-webpack-boilerplate/package.json');
console.log(
'UI: ' +
JSON.stringify(UIInfo.name) +
' ver: ' +
JSON.stringify(UIInfo.version),
);
const webpack = require('webpack'); const webpack = require('webpack');
const commonVariables = require('./webpack.configuration'); const commonVariables = require('./webpack.configuration');
const conf = commonVariables.configuration; const conf = commonVariables.configuration;
const HardSourceWebpackPlugin = require('hard-source-webpack-plugin');
const path = require('path'); const path = require('path');
const filesystem = require('fs'); const filesystem = require('fs');
const UIInfo = require('./node_modules/@a2nt/ss-bootstrap-ui-webpack-boilerplate/package.json');
const UINAME = JSON.stringify(UIInfo.name);
const UIVERSION = JSON.stringify(UIInfo.version);
console.info(`%cUI Kit ${UINAME} ${UIVERSION}`, 'color:yellow;font-size:14px');
const includes = {}; const includes = {};
const modules = [ const modules = [
path.resolve(__dirname, conf.APPDIR, 'client', 'src'), path.resolve(__dirname, conf.APPDIR, 'client', 'src'),
@ -101,16 +104,81 @@ commonVariables.themes.forEach((theme) => {
module.exports = { module.exports = {
entry: includes, entry: includes,
devtool: 'source-map',
externals: { externals: {
jquery: 'jQuery', jquery: 'jQuery',
}, },
optimization: {
namedModules: true, // NamedModulesPlugin()
splitChunks: {
// CommonsChunkPlugin()
name: 'vendor',
minChunks: 2,
},
noEmitOnErrors: true, // NoEmitOnErrorsPlugin
concatenateModules: true, //ModuleConcatenationPlugin
},
module: {
rules: [
{
test: /\.jsx?$/,
//exclude: /node_modules/,
use: {
loader: 'babel-loader',
options: {
presets: ['@babel/preset-env'], //Preset used for env setup
plugins: [
['@babel/transform-react-jsx'],
['react-hot-loader/babel'],
],
cacheDirectory: true,
cacheCompression: false,
},
},
},
/*{
test: /\.tsx?$/,
use: 'ts-loader',
exclude: /node_modules/,
},
{
test: /\.coffee?$/,
use: 'coffee-loader',
},*/
{
test: /\.worker\.js$/,
use: {
loader: 'worker-loader',
},
},
],
},
resolve: { resolve: {
modules: modules, modules: modules,
alias: { alias: {
'window.jQuery': require.resolve('jquery'),
$: require.resolve('jquery'),
jquery: require.resolve('jquery'), jquery: require.resolve('jquery'),
jQuery: require.resolve('jquery'), jQuery: require.resolve('jquery'),
}, },
}, },
plugins: [
new webpack.ProvidePlugin({
$: 'jquery',
jQuery: 'jquery',
'window.jQuery': 'jquery',
Popper: ['popper.js', 'default'],
Util: 'exports-loader?Util!bootstrap/js/dist/util',
Alert: 'exports-loader?Alert!bootstrap/js/dist/alert',
Button: 'exports-loader?Button!bootstrap/js/dist/button',
Carousel: 'exports-loader?Carousel!bootstrap/js/dist/carousel',
Collapse: 'exports-loader?Collapse!bootstrap/js/dist/collapse',
Dropdown: 'exports-loader?Dropdown!bootstrap/js/dist/dropdown',
Modal: 'exports-loader?Modal!bootstrap/js/dist/modal',
Tooltip: 'exports-loader?Tooltip!bootstrap/js/dist/tooltip',
Popover: 'exports-loader?Popover!bootstrap/js/dist/popover',
Scrollspy: 'exports-loader?Scrollspy!bootstrap/js/dist/scrollspy',
Tab: 'exports-loader?Tab!bootstrap/js/dist/tab',
}),
new HardSourceWebpackPlugin(),
],
}; };

View File

View File