Reputation:
I tries to pass an array to DefinePlugin . This array is declared globally and filled in by an another plugin (DirectoryTreePlugi, enhance method). But a browser's debuggers shows what the array is empty.
If I assign some values to the array once I declare it the debugger shows that values. It seems like DefinePlugin is called earlier than DirectoryTreePlugin, but the order of plugins in Webpack config file is DirectoryTreePlugin and then DefinePlugin.
Upvotes: 1
Views: 538
Reputation:
In short, yes, DefinePlugin supports both variales and constants. Thanks to @MatheusSilva pointing me on my misunderstanding about the order of Webpack plugin execution.
I solved my task in the following way.
For doing its job DirectoryTreePlugin uses the directory-tree library. So I just imported it in Webpack config file, filled in my array in dirTree callback and pass it (array) to DefinePlugin.
Upvotes: 1