Skip to content
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

refactor: review feedback #773

Merged
merged 4 commits into from
Nov 25, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ const getPublicUrlOrPath = require('react-dev-utils/getPublicUrlOrPath')
const TerserPlugin = require('terser-webpack-plugin')
const webpack = require('webpack')
const WorkboxWebpackPlugin = require('workbox-webpack-plugin')
const makeBabelConfig = require('../../../config/makeBabelConfig')
const { getPWAEnvVars } = require('../pwa')
const getShellEnv = require('../shell/env')
const { getPWAEnvVars } = require('../src/lib/pwa')
const getShellEnv = require('../src/lib/shell/env')
const makeBabelConfig = require('./makeBabelConfig')

const babelWebpackConfig = {
babelrc: false,
Expand All @@ -36,7 +36,6 @@ module.exports = ({ env: webpackEnv, config, paths }) => {
const shellEnv = getShellEnv({
plugin: 'true',
name: config.title,
// todo: need to make sure PWA is enabled for plugins
...getPWAEnvVars(config),
})

Expand Down Expand Up @@ -276,7 +275,7 @@ module.exports = ({ env: webpackEnv, config, paths }) => {
},
}),
},
// 'asset/resource' fixes fonts, but 'file-loader' breaks css modules
// dhis2: 'asset/resource' fixes fonts, but 'file-loader' breaks css modules
// when used for all asset types. So use each for respective files
{
test: /\.(woff|woff2|eot|ttf|otf)$/i,
Expand Down Expand Up @@ -311,6 +310,5 @@ module.exports = ({ env: webpackEnv, config, paths }) => {
},
// Saves some chunk size logging
performance: false,
// stats: 'verbose',
}
}
1 change: 0 additions & 1 deletion cli/src/lib/parseConfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ const validateConfig = (config) => {
)
}
})
// Todo: make sure apps with plugins have `pwa_enabled: true` in the config
return true
}

Expand Down
2 changes: 1 addition & 1 deletion cli/src/lib/plugin/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ process.env.NODE_ENV = 'production'

const { reporter } = require('@dhis2/cli-helpers-engine')
const webpack = require('webpack')
const webpackConfigFactory = require('./webpack.config')
const webpackConfigFactory = require('../../../config/plugin.webpack.config')

module.exports = async ({ config, paths }) => {
reporter.debug('Building plugin...')
Expand Down
3 changes: 2 additions & 1 deletion cli/src/lib/plugin/start.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,12 @@ process.env.NODE_ENV = 'development'
const getPublicUrlOrPath = require('react-dev-utils/getPublicUrlOrPath')
const webpack = require('webpack')
const WebpackDevServer = require('webpack-dev-server')
const webpackConfigFactory = require('./webpack.config')
const webpackConfigFactory = require('../../../config/plugin.webpack.config')

module.exports = async ({ port, config, paths }) => {
const webpackConfig = webpackConfigFactory({
// todo: change to development, but this creates a compilation error
// can read more here: https://github.com/dhis2/app-platform/pull/740/files/69411d9b61845cbd0d053f2313bdbd4e80fdf2ac#r1031576956
env: 'production',
config,
paths,
Expand Down