Skip to content

Commit

Permalink
Merge pull request #765 from noirbizarre/fix-common-packaging
Browse files Browse the repository at this point in the history
Fix common.js packaging
  • Loading branch information
noirbizarre committed Feb 16, 2017
2 parents 95f2cb9 + 5c08d6d commit ff37609
Show file tree
Hide file tree
Showing 9 changed files with 42 additions and 28 deletions.
2 changes: 1 addition & 1 deletion js/components/popover.vue
Expand Up @@ -9,7 +9,7 @@
import log from 'logger';
import TooltipMixin from 'mixins/tooltip';
import { popover } from 'vue-strap'; // Needed for style
import 'vue-strap/src/Popover.vue'; // Needed for style
export default {
mixins: [TooltipMixin],
Expand Down
4 changes: 2 additions & 2 deletions js/components/tab.js
@@ -1,7 +1,7 @@
import {tab} from 'vue-strap';
import Tab from 'vue-strap/src/Tab.vue';

export default {
mixins: [tab],
mixins: [Tab],
props: {
id: String
}
Expand Down
2 changes: 1 addition & 1 deletion js/components/tooltip.vue
Expand Up @@ -9,7 +9,7 @@
import log from 'logger';
import TooltipMixin from 'mixins/tooltip';
import { tooltip } from 'vue-strap'; // Needed for style
import 'vue-strap/src/Tooltip.vue'; // Needed for style
export default {
mixins: [TooltipMixin],
Expand Down
4 changes: 2 additions & 2 deletions js/front/organization/index.js
Expand Up @@ -10,7 +10,7 @@ import i18n from 'i18n';

import Vue from 'vue';

import {tabset} from 'vue-strap';
import Tabset from 'vue-strap/src/Tabset.vue';

import FollowButton from 'components/buttons/follow.vue';
import ActivityTimeline from 'components/activities/timeline.vue';
Expand All @@ -27,7 +27,7 @@ Vue.options.replace = false;

new Vue({
el: 'body',
components: {FollowButton, Tab, tabset, ActivityTimeline, DashboardGraphs, SmallBox},
components: {FollowButton, Tab, Tabset, ActivityTimeline, DashboardGraphs, SmallBox},
data() {
return {
followersVisible: false,
Expand Down
4 changes: 2 additions & 2 deletions js/front/user.js
Expand Up @@ -7,15 +7,15 @@ import log from 'logger';

import Vue from 'vue';

import {tabset} from 'vue-strap';
import Tabset from 'vue-strap/src/Tabset.vue';

import FollowButton from 'components/buttons/follow.vue';
import ActivityTimeline from 'components/activities/timeline.vue';
import Tab from 'components/tab';

new Vue({
el: 'body',
components: {FollowButton, Tab, tabset, ActivityTimeline},
components: {FollowButton, Tab, Tabset, ActivityTimeline},
data() {
return {
// Current tab index
Expand Down
5 changes: 4 additions & 1 deletion js/i18n.js
Expand Up @@ -12,7 +12,10 @@ export const lang = config.lang;
const resources = {};

resources[lang] = {};
resources[lang][NAMESPACE] = require('locales/' + NAMESPACE + '.' + lang + '.json');
// Force split and async loading of locale (and so remove them from common.js)
require.ensure([], function() {
resources[lang][NAMESPACE] = require('locales/' + NAMESPACE + '.' + lang + '.json');
});

moment.locale(lang);
i18next.init({
Expand Down
2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -7,7 +7,7 @@
"main": "index.js",
"scripts": {
"assets:watch": "webpack -c -d --progress --watch",
"assets:build": "webpack -p --progress --config webpack.config.prod.js",
"assets:build": "webpack --progress --config webpack.config.prod.js",
"widgets:watch": "webpack -c -d --progress --watch --config webpack.config.widgets.js",
"widgets:build": "webpack -p --progress --config webpack.config.widgets.prod.js",
"build": "npm run assets:build && npm run widgets:build",
Expand Down
6 changes: 5 additions & 1 deletion webpack.config.js
Expand Up @@ -55,7 +55,11 @@ module.exports = {
{test: /\.json$/, loader: 'json-loader'},
{test: /\.hbs$/, loader: hbs_loader},
{test: /\.(woff|svg|ttf|eot|otf)([\?]?.*)$/, exclude: /img/, loader: 'file-loader?name=[name].[ext]'},
{test: /\.js$/, exclude: /node_modules/, loader: 'babel-loader'},
{test: /\.js$/, loader: 'babel-loader', include: [
path.resolve(__dirname, 'js'),
path.resolve(__dirname, 'node_modules/vue-strap/src'),
]
}
]
},
vue: {
Expand Down
41 changes: 24 additions & 17 deletions webpack.config.prod.js
@@ -1,26 +1,33 @@
var webpack = require('webpack');
var config = require('./webpack.config');

config.plugins.push(new webpack.optimize.UglifyJsPlugin({
minimize: true,
output: {
comments: false,
screw_ie8: true
},
mangle: {
screw_ie8: true
},
compress: {
warnings: false,
screw_ie8: true
}
}));
config.plugins.push(
new webpack.DefinePlugin({
'process.env': {
NODE_ENV: '"production"'
}
}),
new webpack.optimize.UglifyJsPlugin({
minimize: true,
output: {
comments: false,
screw_ie8: true
},
mangle: {
screw_ie8: true,
keep_fnames: true
},
compress: {
warnings: false,
screw_ie8: true
}
}),
new webpack.optimize.DedupePlugin(),
new webpack.optimize.OccurenceOrderPlugin(true)
);

config.devtool = 'source-map';

config.plugins.push(new webpack.optimize.DedupePlugin());
config.plugins.push(new webpack.optimize.OccurenceOrderPlugin(true));

/**
* Image optimization.
* Not working yet
Expand Down

0 comments on commit ff37609

Please sign in to comment.