1
0
mirror of https://github.com/LaCasemate/fab-manager.git synced 2025-01-29 18:52:22 +01:00

[WIP] fix webpack dependencies with global variables

Using:
- expose-loader
- exports-loader
- import-loader
- https://medium.com/@drgenejones/using-webpack-with-legacy-angular-spas-exposing-global-variables-to-child-modules-599e32f373c9
This commit is contained in:
Sylvain 2020-09-16 16:54:56 +02:00
parent ad2ca33c6f
commit 45d60952b7
6 changed files with 14 additions and 4 deletions

View File

@ -6,7 +6,7 @@
*/
// eslint-disable-next-line no-use-before-define
const Application = Application || {};
var Application = Application || {};
Application.Constants = angular.module('application.constants', []);
Application.Services = angular.module('application.services', []);

View File

@ -25,7 +25,7 @@ environment.loaders.append('sass', sass);
environment.loaders.append('fonts', fonts);
environment.loaders.append('expose-app', exposeApp);
environment.loaders.append('imports', imports);
// environment.loaders.append('imports', imports);
environment.splitChunks();

View File

@ -2,6 +2,6 @@ module.exports = {
test: require.resolve('../../../app/frontend/src/javascript/app.js'),
loader: 'expose-loader',
options: {
exposes: 'app'
exposes: 'Application Application'
}
};

View File

@ -5,7 +5,7 @@ module.exports = {
loader: 'imports-loader',
options: {
imports: [
'default app Application'
'default Application Application'
]
}
}

View File

@ -24,6 +24,7 @@
"eslint-plugin-node": "~11.0.0",
"eslint-plugin-promise": "~4.2.1",
"eslint-plugin-standard": "~4.0.1",
"exports-loader": "^1.1.0",
"expose-loader": "^1.0.0",
"file-loader": "^6.1.0",
"html-loader": "^1.3.0",

View File

@ -3488,6 +3488,15 @@ expand-tilde@^2.0.0, expand-tilde@^2.0.2:
dependencies:
homedir-polyfill "^1.0.1"
exports-loader@^1.1.0:
version "1.1.0"
resolved "https://registry.yarnpkg.com/exports-loader/-/exports-loader-1.1.0.tgz#26a16706e4cf533145de24c1419baf33b624fb5c"
integrity sha512-zGB2SujiAyO0Rwn4GQ17/HlT8cwmT8abcBeZpr2R3sItJ5sI5Y9BzNzus3H9tH1iWLAoJLi9N3TP54D2+j859Q==
dependencies:
loader-utils "^2.0.0"
schema-utils "^2.7.0"
source-map "^0.6.1"
expose-loader@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/expose-loader/-/expose-loader-1.0.0.tgz#1676dde8fce6662584e17f8531e24d2afe8dae11"