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

Fix common packaging #765

Merged
merged 3 commits into from
Feb 16, 2017
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
2 changes: 1 addition & 1 deletion js/components/popover.vue
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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)
Copy link
Member

Choose a reason for hiding this comment

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

👍

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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
@@ -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({
Copy link
Member

Choose a reason for hiding this comment

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

Why is that plugin required now?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Setting this environment variable drop some Vue.js code (warnings and some debug helpers) in production.

'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