-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: this set default values to the content of .env instead of .env.… #27
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
@@ -1,9 +1,23 @@ | ||||||||||||||||||
const fs = require('fs'); | ||||||||||||||||||
const dotenv = require('dotenv'); | ||||||||||||||||||
const path = require('path'); | ||||||||||||||||||
const { createConfig } = require('@edx/frontend-build'); | ||||||||||||||||||
const CopyPlugin = require('copy-webpack-plugin'); | ||||||||||||||||||
|
||||||||||||||||||
const config = createConfig('webpack-prod'); | ||||||||||||||||||
|
||||||||||||||||||
// The configuration is generated using the createConfig method from the frontend-build library, | ||||||||||||||||||
// this method preloads multiple files to generate the resulting configuration, including webpack.common.config.js, | ||||||||||||||||||
// https://github.com/nelc/frontend-build/blob/open-release/palm.nelp/config/webpack.common.config.js, | ||||||||||||||||||
// which includes ParagonWebpackPlugin. This plugin, in turn, retrieves its configuration from the .env.development file | ||||||||||||||||||
// https://github.com/nelc/frontend-build/blob/open-release/palm.nelp/lib/plugins/paragon-webpack-plugin/ParagonWebpackPlugin.js#L20-L22 | ||||||||||||||||||
// Therefore, regardless of the configuration type, the plugin always utilizes data from .env.development. | ||||||||||||||||||
// The following code overrides this behavior in order to use the .env file. | ||||||||||||||||||
const envConfig = dotenv.parse(fs.readFileSync('.env')); | ||||||||||||||||||
Object.keys(envConfig).forEach(k => { | ||||||||||||||||||
process.env[k] = envConfig[k]; | ||||||||||||||||||
}); | ||||||||||||||||||
|
||||||||||||||||||
Comment on lines
+16
to
+20
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
I think that could do the same, You could try... There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. the override feature was included in the 15.0.0 version we are in the 8.6 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. So the way you did it, is the way. |
||||||||||||||||||
config.plugins.push( | ||||||||||||||||||
new CopyPlugin({ | ||||||||||||||||||
patterns: [ | ||||||||||||||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
now, it's really clear