Use rails plugin info only in main config

If we use it within the vendors config, we must ensure that
`npm install` is always called when the bundle is complete.

That might confuse users and caused issues on docker and packager build.
pull/5249/head
Oliver Günther 8 years ago
parent f523af9cce
commit f022c20874
No known key found for this signature in database
GPG Key ID: 88872239EB414F99
  1. 4
      frontend/app/init-app.js
  2. 4
      frontend/app/vendors.js
  3. 5
      frontend/webpack-main-config.js
  4. 22
      frontend/webpack-vendors-config.js

@ -39,6 +39,10 @@ require('jquery-ui/themes/base/datepicker.css');
require('jquery-ui/themes/base/dialog.css');
require('nouislider/distribute/nouislider.min.css');
// load I18n, depending on the html element having a 'lang' attribute
var documentLang = (angular.element('html').attr('lang') || 'en').toLowerCase();
require('angular-i18n/angular-locale_' + documentLang + '.js');
var opApp = require('./angular-modules.ts').default;
window.appBasePath = jQuery('meta[name=app_base_path]').attr('content') || '';

@ -55,10 +55,6 @@ require('angular-truncate/src/truncate.js');
require('angular-ui-router/release/angular-ui-router.min.js');
require('ng-file-upload/dist/ng-file-upload.min.js');
// depends on the html element having a 'lang' attribute
var documentLang = (angular.element('html').attr('lang') || 'en').toLowerCase();
require('angular-i18n/angular-locale_' + documentLang + '.js');
// Jquery UI
require('jquery-ui/ui/core.js');
require('jquery-ui/ui/position.js');

@ -256,7 +256,10 @@ function getWebpackMainConfig() {
new webpack.ContextReplacementPlugin(
/(angular-i18n)/,
new RegExp('angular-locale_(' + localeIds.join('|') + ')\.js$', 'i')
)
),
// Restrict loaded moment locales to the ones we load from translations
new webpack.ContextReplacementPlugin(/moment[\/\\]locale$/, new RegExp('(' + localeIds.join('|') + ')\.js$', 'i'))
]
};

@ -30,7 +30,6 @@ var webpack = require('webpack');
var fs = require('fs');
var path = require('path');
var _ = require('lodash');
var pathConfig = require('./rails-plugins.conf');
var autoprefixer = require('autoprefixer');
var ExtractTextPlugin = require('extract-text-webpack-plugin');
@ -43,16 +42,6 @@ var node_root = path.resolve(__dirname, 'node_modules');
var output_root = path.resolve(__dirname, '..', 'app', 'assets', 'javascripts');
var bundle_output = path.resolve(output_root, 'bundles')
/** Extract available locales from openproject-translations plugin */
var translations = path.resolve(pathConfig.allPluginNamesPaths['openproject-translations'], 'config', 'locales');
var localeIds = ['en'];
fs.readdirSync(translations).forEach(function (file) {
var matches = file.match( /^js-(.+)\.yml$/);
if (matches && matches.length > 1) {
localeIds.push(matches[1]);
}
});
function getWebpackVendorsConfig() {
config = {
entry: {
@ -84,16 +73,7 @@ function getWebpackVendorsConfig() {
new CleanWebpackPlugin(['bundles'], {
root: output_root,
verbose: true
}),
// Restrict loaded ngLocale locales to the ones we load from translations
new webpack.ContextReplacementPlugin(
/angular\-i18n/,
new RegExp('angular\-locale\_(' + localeIds.join('|') + ')\.js$', 'i')
),
// Restrict loaded moment locales to the ones we load from translations
new webpack.ContextReplacementPlugin(/moment[\/\\]locale$/, new RegExp('(' + localeIds.join('|') + ')\.js$', 'i'))
})
]
};

Loading…
Cancel
Save