Open HeikkiYlipaavalniemi opened 2 years ago
We seem to been able to fix this by adding this to the webpack.common.js
and refactoring our custom JS a bit to make sure that Drupal variable is passed along correctly.
externals: {
'Drupal': 'Drupal',
},
At the moment when I am using Webpack to minify the JS files it makes it impossible to use functions like Drupal.t() to translate strings with JS.
The problem being that
Drupal
is being replaced by for exampler
in the minified JS file which leads to the following error:There is also a drupal.org issue about a similar problem: https://www.drupal.org/project/drupal/issues/2893361
The suggested fix would be to add a following config to Webpack:
externals: {"drupal": "Drupal" },
I tested adding this to webpack.common.js under the exports but it didn't seem to have an effect when building the JS.
Has anyone else encountered this problem?