Skip to content

Commit 652973c

Browse files
committed
Legacy browser support
Prior to this change, the js + css would target modern browsers. This change adds autoprefixer to output css for older browsers and babel for the js. Realistically, ie6 support is not possible. This change ensures the modern features of css and js are kept back as much as possible. As the templates function without javascript, really old browsers should click perform the redirect automatically. Apart from autosubmit, no js is used.
1 parent 0423bcc commit 652973c

File tree

7 files changed

+144
-32
lines changed

7 files changed

+144
-32
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
## 6.0.0
44
- Upgrade from Symfony 6.4 to Symfony 7.3
55
- Maintenance release, Update tooling, packages
6+
- Update npm packages and frontend tooling.
67

78
Upgrade instructions:
89
- Ensure the `database_server_version` setting in parameters.yaml is up-to-date with the production db server version. e.g. `10.6.23-MariaDB`

package.json

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,29 @@
11
{
2-
"browserslist": "last 2 versions, ie 11, > 1%",
2+
"browserslist": [
3+
"last 2 versions",
4+
"ie 11",
5+
"> 1%"
6+
],
37
"devDependencies": {
48
"@babel/core": "^7.26.9",
59
"@babel/preset-env": "^7.26.9",
610
"@eslint/eslintrc": "^3.3.1",
711
"@eslint/js": "^9.39.1",
8-
"@popperjs/core": "^2.11.8",
912
"@symfony/webpack-encore": "^5.3.1",
1013
"@types/bootstrap": "^5.0.0",
1114
"@types/jquery": "^3.5.32",
1215
"@types/node": "^20.0.0",
1316
"@typescript-eslint/eslint-plugin": "^8.47.0",
1417
"@typescript-eslint/parser": "^8.47.0",
18+
"autoprefixer": "^10.4.20",
1519
"css-loader": "^7.1.2",
1620
"eslint": "^9.39.1",
1721
"eslint-webpack-plugin": "^5.0.2",
1822
"less": "^4.4.2",
1923
"less-loader": "^12.3.0",
2024
"loader-utils": "^3.3",
2125
"postcss": ">=8.4.31",
26+
"postcss-loader": "^8.1.1",
2227
"sass": "^1.94.1",
2328
"sass-loader": "^16.0.6",
2429
"ts-loader": "^9",
@@ -33,11 +38,10 @@
3338
"dependencies": {
3439
"@popperjs/core": "^2.11.8",
3540
"bootstrap": "^5.3.3",
41+
"core-js": "^3.37.0",
3642
"jquery": "^3.7.1",
43+
"regenerator-runtime": "^0.14.1",
3744
"select2": "^4.0.3",
3845
"yargs-parser": ">=18.1.2"
39-
},
40-
"resolutions": {
41-
"json5": ">=2.2.2"
4246
}
4347
}

postcss.config.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
module.exports = {
2+
plugins: [
3+
require('autoprefixer')()
4+
]
5+
};
6+

public/typescript/app.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@
1616
import jQuery from 'jquery';
1717
import 'bootstrap';
1818

19+
// Ensure module context for Babel
20+
export {};
21+
1922
declare global {
2023
interface Window {
2124
jQuery: typeof jQuery;

tsconfig.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"compilerOptions": {
33
/* Basic Options */
4-
"target": "es5", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017','ES2018' or 'ESNEXT'. */
4+
"target": "es2017", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017','ES2018' or 'ESNEXT'. */
55
"module": "commonjs", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */
66
"lib": [
77
"esnext",
@@ -20,7 +20,7 @@
2020
// "removeComments": true, /* Do not emit comments to output. */
2121
// "noEmit": true, /* Do not emit outputs. */
2222
// "importHelpers": true, /* Import emit helpers from 'tslib'. */
23-
// "downlevelIteration": true, /* Provide full support for iterables in 'for-of', spread, and destructuring when targeting 'ES5' or 'ES3'. */
23+
"downlevelIteration": true, /* Provide full support for iterables in 'for-of', spread, and destructuring when targeting 'ES5' or 'ES3'. */
2424
// "isolatedModules": true, /* Transpile each file as a separate module (similar to 'ts.transpileModule'). */
2525

2626
/* Strict Type-Checking Options */
@@ -43,7 +43,7 @@
4343
],
4444

4545
/* Module Resolution Options */
46-
// "moduleResolution": "node", /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */
46+
"moduleResolution": "node", /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */
4747
"baseUrl": "./", /* Base directory to resolve non-absolute module names. */
4848
// "paths": {}, /* A series of entries which re-map imports to lookup locations relative to the 'baseUrl'. */
4949
// "rootDirs": [], /* List of root folders whose combined content represents the structure of the project at runtime. */

webpack.config.js

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,16 @@ const Encore = require('@symfony/webpack-encore');
22
const ESLintPlugin = require('eslint-webpack-plugin');
33
const path = require('path');
44

5+
if (!Encore.isRuntimeEnvironmentConfigured()) {
6+
Encore.configureRuntimeEnvironment(process.env.NODE_ENV || 'development');
7+
}
8+
9+
Encore.configureBabelPresetEnv(config => {
10+
config.useBuiltIns = 'usage';
11+
config.corejs = 3;
12+
config.targets = { ie: '11' };
13+
});
14+
515
Encore
616
.setOutputPath('public/build/')
717
.setPublicPath('/build')
@@ -17,6 +27,7 @@ Encore
1727
};
1828
options.webpackImporter = false;
1929
})
30+
.enablePostCssLoader()
2031

2132
.addStyleEntry('global', [
2233
'./public/scss/application.scss',
@@ -32,8 +43,7 @@ Encore
3243
files: 'public/typescript',
3344
emitWarning: true,
3445
failOnError: Encore.isProduction(),
35-
context: path.resolve(__dirname),
36-
overrideConfigFile: path.resolve(__dirname, 'eslint.json'),
46+
context: path.resolve(__dirname)
3747
}))
3848

3949
.enableSingleRuntimeChunk()

0 commit comments

Comments
 (0)