@@ -3,6 +3,8 @@ const env = require("./env.cjs");
3
3
const paths = require ( "./paths.cjs" ) ;
4
4
const { dependencies } = require ( "../package.json" ) ;
5
5
6
+ const BABEL_PLUGINS = path . join ( __dirname , "babel-plugins" ) ;
7
+
6
8
// GitHub base URL to use for production source maps
7
9
// Nightly builds use the commit SHA, otherwise assumes there is a tag that matches the version
8
10
module . exports . sourceMapURL = ( ) => {
@@ -100,22 +102,12 @@ module.exports.babelOptions = ({ latestBuild, isProdBuild, isTestBuild }) => ({
100
102
] ,
101
103
plugins : [
102
104
[
103
- path . resolve (
104
- paths . polymer_dir ,
105
- "build-scripts/babel-plugins/inline-constants-plugin.cjs"
106
- ) ,
105
+ path . join ( BABEL_PLUGINS , "inline-constants-plugin.cjs" ) ,
107
106
{
108
107
modules : [ "@mdi/js" ] ,
109
108
ignoreModuleNotFound : true ,
110
109
} ,
111
110
] ,
112
- [
113
- path . resolve (
114
- paths . polymer_dir ,
115
- "build-scripts/babel-plugins/custom-polyfill-plugin.js"
116
- ) ,
117
- { method : "usage-global" } ,
118
- ] ,
119
111
// Minify template literals for production
120
112
isProdBuild && [
121
113
"template-html-minifier" ,
@@ -153,6 +145,17 @@ module.exports.babelOptions = ({ latestBuild, isProdBuild, isTestBuild }) => ({
153
145
] ,
154
146
sourceMaps : ! isTestBuild ,
155
147
overrides : [
148
+ {
149
+ // Add plugin to inject various polyfills, excluding the polyfills
150
+ // themselves to prevent self- injection.
151
+ plugins : [
152
+ [
153
+ path . join ( BABEL_PLUGINS , "custom-polyfill-plugin.js" ) ,
154
+ { method : "usage-global" } ,
155
+ ] ,
156
+ ] ,
157
+ exclude : / \/ n o d e _ m o d u l e s \/ (?: u n f e t c h | p r o x y - p o l y f i l l ) \/ / ,
158
+ } ,
156
159
{
157
160
// Use unambiguous for dependencies so that require() is correctly injected into CommonJS files
158
161
// Exclusions are needed in some cases where ES modules have no static imports or exports, such as polyfills
0 commit comments