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

Remove lodash.merge dependency #1911

Merged
merged 1 commit into from Jul 13, 2023
Merged

Remove lodash.merge dependency #1911

merged 1 commit into from Jul 13, 2023

Conversation

tiziodcaio
Copy link
Contributor

Description

Remove lodash.merge dependency from webpack.config.js file, replacing it with using spread sintax

@SleeplessOne1917
Copy link
Member

Have you tested this? Sometimes merge is needed because the spread syntax is only shallow merge but you need a deep merge.

@tiziodcaio
Copy link
Contributor Author

tiziodcaio commented Jul 13, 2023

Yes, I confirm everything work.

Tested adding these lines to webpack.config.js and running various tests

  console.log(mode)
  console.log(serverConfig)
  console.log(clientConfig)
Logs
Welcome to fish, the friendly interactive shell
Type help for instructions on how to use fish
daniele@hp ~/g/lemmy-ui (main)> yarn run dev
yarn run v1.22.19
$ yarn build:dev --watch
$ yarn clean && node generate_translations.js
$ yarn run rimraf dist
$ /home/daniele/git/lemmy-ui/node_modules/.bin/rimraf dist
$ webpack --env LEMMY_UI_DISABLE_CSP=true --env COMMIT_HASH=$(git rev-parse --short HEAD) --mode=development --watch
{
  output: { filename: 'js/server.js' },
  resolve: {
    extensions: [ '.js', '.jsx', '.ts', '.tsx' ],
    alias: {
      '@': '/home/daniele/git/lemmy-ui/src',
      '@utils': '/home/daniele/git/lemmy-ui/src/shared/utils'
    }
  },
  performance: { hints: false },
  module: { rules: [ [Object], [Object], [Object] ] },
  plugins: [
    DefinePlugin { definitions: [Object] },
    MiniCssExtractPlugin {
      _sortedModulesCache: [WeakMap],
      options: [Object],
      runtimeOptions: [Object]
    },
    CopyPlugin { patterns: [Array], options: {} },
    BannerPlugin { options: [Object], banner: [Function (anonymous)] },
    RunNodeWebpackPlugin {
      isWebpackInWatchMode: false,
      isFirstRun: true,
      errorsInPrevCompilation: false,
      options: [Object]
    }
  ],
  entry: './src/server/index.tsx',
  target: 'node',
  externals: [ [Function (anonymous)], 'inferno-helmet' ]
}
{
  output: { filename: 'js/client.js', publicPath: '/static/3bcb328d/' },
  resolve: {
    extensions: [ '.js', '.jsx', '.ts', '.tsx' ],
    alias: {
      '@': '/home/daniele/git/lemmy-ui/src',
      '@utils': '/home/daniele/git/lemmy-ui/src/shared/utils'
    }
  },
  performance: { hints: false },
  module: { rules: [ [Object], [Object], [Object] ] },
  plugins: [
    DefinePlugin { definitions: [Object] },
    MiniCssExtractPlugin {
      _sortedModulesCache: [WeakMap],
      options: [Object],
      runtimeOptions: [Object]
    },
    CopyPlugin { patterns: [Array], options: {} },
    BannerPlugin { options: [Object], banner: [Function (anonymous)] },
    ServiceWorkerPlugin { config: [Object] }
  ],
  entry: './src/client/index.tsx'
}
^C⏎                                                                                                                                                                       
daniele@hp ~/g/lemmy-ui (main) [SIGINT]> yarn run dev
yarn run v1.22.19
$ yarn build:dev --watch
$ yarn clean && node generate_translations.js
$ yarn run rimraf dist
$ /home/daniele/git/lemmy-ui/node_modules/.bin/rimraf dist
$ webpack --env LEMMY_UI_DISABLE_CSP=true --env COMMIT_HASH=$(git rev-parse --short HEAD) --mode=development --watch
development
{
  output: { filename: 'js/server.js' },
  resolve: {
    extensions: [ '.js', '.jsx', '.ts', '.tsx' ],
    alias: {
      '@': '/home/daniele/git/lemmy-ui/src',
      '@utils': '/home/daniele/git/lemmy-ui/src/shared/utils'
    }
  },
  performance: { hints: false },
  module: { rules: [ [Object], [Object], [Object] ] },
  plugins: [
    DefinePlugin { definitions: [Object] },
    MiniCssExtractPlugin {
      _sortedModulesCache: [WeakMap],
      options: [Object],
      runtimeOptions: [Object]
    },
    CopyPlugin { patterns: [Array], options: {} },
    BannerPlugin { options: [Object], banner: [Function (anonymous)] },
    RunNodeWebpackPlugin {
      isWebpackInWatchMode: false,
      isFirstRun: true,
      errorsInPrevCompilation: false,
      options: [Object]
    }
  ],
  entry: './src/server/index.tsx',
  target: 'node',
  externals: [ [Function (anonymous)], 'inferno-helmet' ]
}
{
  output: { filename: 'js/client.js', publicPath: '/static/3bcb328d/' },
  resolve: {
    extensions: [ '.js', '.jsx', '.ts', '.tsx' ],
    alias: {
      '@': '/home/daniele/git/lemmy-ui/src',
      '@utils': '/home/daniele/git/lemmy-ui/src/shared/utils'
    }
  },
  performance: { hints: false },
  module: { rules: [ [Object], [Object], [Object] ] },
  plugins: [
    DefinePlugin { definitions: [Object] },
    MiniCssExtractPlugin {
      _sortedModulesCache: [WeakMap],
      options: [Object],
      runtimeOptions: [Object]
    },
    CopyPlugin { patterns: [Array], options: {} },
    BannerPlugin { options: [Object], banner: [Function (anonymous)] },
    ServiceWorkerPlugin { config: [Object] }
  ],
  entry: './src/client/index.tsx'
}
^C⏎                                                                                                                                                                       
daniele@hp ~/g/lemmy-ui (main) [SIGINT]> yarn run analyze
yarn run v1.22.19
$ webpack --mode=none
none
{
  output: { filename: 'js/server.js' },
  resolve: {
    extensions: [ '.js', '.jsx', '.ts', '.tsx' ],
    alias: {
      '@': '/home/daniele/git/lemmy-ui/src',
      '@utils': '/home/daniele/git/lemmy-ui/src/shared/utils'
    }
  },
  performance: { hints: false },
  module: { rules: [ [Object], [Object], [Object] ] },
  plugins: [
    DefinePlugin { definitions: [Object] },
    MiniCssExtractPlugin {
      _sortedModulesCache: [WeakMap],
      options: [Object],
      runtimeOptions: [Object]
    },
    CopyPlugin { patterns: [Array], options: {} },
    BannerPlugin { options: [Object], banner: [Function (anonymous)] },
    BundleAnalyzerPlugin {
      opts: [Object],
      server: null,
      logger: [Logger]
    }
  ],
  entry: './src/server/index.tsx',
  target: 'node',
  externals: [ [Function (anonymous)], 'inferno-helmet' ]
}
{
  output: { filename: 'js/client.js', publicPath: '/static/undefined/' },
  resolve: {
    extensions: [ '.js', '.jsx', '.ts', '.tsx' ],
    alias: {
      '@': '/home/daniele/git/lemmy-ui/src',
      '@utils': '/home/daniele/git/lemmy-ui/src/shared/utils'
    }
  },
  performance: { hints: false },
  module: { rules: [ [Object], [Object], [Object] ] },
  plugins: [
    DefinePlugin { definitions: [Object] },
    MiniCssExtractPlugin {
      _sortedModulesCache: [WeakMap],
      options: [Object],
      runtimeOptions: [Object]
    },
    CopyPlugin { patterns: [Array], options: {} },
    BannerPlugin { options: [Object], banner: [Function (anonymous)] },
    ServiceWorkerPlugin { config: [Object] }
  ],
  entry: './src/client/index.tsx'
}
^C⏎                                                                                                                                                                       
daniele@hp ~/g/lemmy-ui (main) [SIGINT]> yarn run build:prod
yarn run v1.22.19
$ yarn clean && node generate_translations.js
$ yarn run rimraf dist
$ /home/daniele/git/lemmy-ui/node_modules/.bin/rimraf dist
$ webpack --env COMMIT_HASH=$(git rev-parse --short HEAD) --mode=production
production
{
  output: { filename: 'js/server.js' },
  resolve: {
    extensions: [ '.js', '.jsx', '.ts', '.tsx' ],
    alias: {
      '@': '/home/daniele/git/lemmy-ui/src',
      '@utils': '/home/daniele/git/lemmy-ui/src/shared/utils'
    }
  },
  performance: { hints: false },
  module: { rules: [ [Object], [Object], [Object] ] },
  plugins: [
    DefinePlugin { definitions: [Object] },
    MiniCssExtractPlugin {
      _sortedModulesCache: [WeakMap],
      options: [Object],
      runtimeOptions: [Object]
    },
    CopyPlugin { patterns: [Array], options: {} },
    BannerPlugin { options: [Object], banner: [Function (anonymous)] }
  ],
  entry: './src/server/index.tsx',
  target: 'node',
  externals: [ [Function (anonymous)], 'inferno-helmet' ]
}
{
  output: { filename: 'js/client.js', publicPath: '/static/3bcb328d/' },
  resolve: {
    extensions: [ '.js', '.jsx', '.ts', '.tsx' ],
    alias: {
      '@': '/home/daniele/git/lemmy-ui/src',
      '@utils': '/home/daniele/git/lemmy-ui/src/shared/utils'
    }
  },
  performance: { hints: false },
  module: { rules: [ [Object], [Object], [Object] ] },
  plugins: [
    DefinePlugin { definitions: [Object] },
    MiniCssExtractPlugin {
      _sortedModulesCache: [WeakMap],
      options: [Object],
      runtimeOptions: [Object]
    },
    CopyPlugin { patterns: [Array], options: {} },
    BannerPlugin { options: [Object], banner: [Function (anonymous)] },
    ServiceWorkerPlugin { config: [Object] }
  ],
  entry: './src/client/index.tsx'
}
^C⏎                                                                                                                                                                       
daniele@hp ~/g/lemmy-ui (main) [SIGINT]> 

Remove lodash.merge dependency from webpack.config.js file, replacing it with using spread sintax (https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Spread_syntax)
@SleeplessOne1917 SleeplessOne1917 merged commit dbeab64 into LemmyNet:main Jul 13, 2023
1 check passed
SleeplessOne1917 pushed a commit that referenced this pull request Jul 14, 2023
dessalines pushed a commit that referenced this pull request Jul 21, 2023
Remove lodash.merge dependency from webpack.config.js file, replacing it with using spread sintax (https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Spread_syntax)
dessalines pushed a commit that referenced this pull request Jul 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants