Skip to content

Automatically add all serverRegistration and clientRegistration files to webpack . #237

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

Closed
wants to merge 2 commits into from
Closed
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
75 changes: 61 additions & 14 deletions client/npm-shrinkwrap.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@
"expose-loader": "^0.7.1",
"extract-text-webpack-plugin": "^1.0.1",
"file-loader": "^0.8.5",
"glob": "^7.0.0",
"immutable": "^3.7.6",
"imports-loader": "^0.6.5",
"jquery": "^2.2.0",
Expand Down
5 changes: 2 additions & 3 deletions client/webpack.client.base.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
const webpack = require('webpack');
const path = require('path');
const autoprefixer = require('autoprefixer');
const glob = require('glob');

const devBuild = process.env.NODE_ENV !== 'production';
const nodeEnv = devBuild ? 'development' : 'production';
Expand All @@ -20,9 +21,7 @@ module.exports = {
],

// This will contain the app entry points defined by webpack.hot.config and webpack.rails.config
app: [
'./app/bundles/comments/startup/clientRegistration',
],
app: glob.sync('./app/bundles/**/startup/clientRegistration.js*'),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@alexfedoseev @robwise Too much magic, or something we'd use?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's ok if we want to compile all bundles into single output, but usually it looks like this:

someBundle: './app/bundles/someBundle/startup/clientRegistration.js',
someOtherBundle: './app/bundles/someOtherBundle/startup/clientRegistration.js',

So globbing doesn't help much.

},
resolve: {
extensions: ['', '.js', '.jsx'],
Expand Down
3 changes: 2 additions & 1 deletion client/webpack.server.rails.build.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

const webpack = require('webpack');
const path = require('path');
const glob = require('glob');

const devBuild = process.env.NODE_ENV !== 'production';
const nodeEnv = devBuild ? 'development' : 'production';
Expand All @@ -12,7 +13,7 @@ module.exports = {
context: __dirname,
entry: [
'babel-polyfill',
'./app/bundles/comments/startup/serverRegistration',
...glob.sync('./app/bundles/**/startup/serverRegistration.js*'),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@alexfedoseev @robwise Too much magic, or something we'd use?

],
output: {
filename: 'server-bundle.js',
Expand Down