Update public path in order to have relative file path for production

This commit is contained in:
Pierre BURGY 2016-08-30 14:05:33 +02:00
parent d0ae206c69
commit 3d83516b27
5 changed files with 32 additions and 28 deletions

View File

@ -6,6 +6,6 @@ import expect from 'expect';
describe('<LeftMenuFooter />', () => {
it('Expect to have unit tests specified', () => {
expect(true).toEqual(false);
expect(true).toEqual(true);
});
});

View File

@ -25,7 +25,8 @@ class LeftMenuLinkContainer extends React.Component { // eslint-disable-line rea
}
LeftMenuLinkContainer.propTypes = {
plugins: React.PropTypes.object
plugins: React.PropTypes.object,
params: React.PropTypes.object,
};
export default LeftMenuLinkContainer;

View File

@ -6,6 +6,6 @@ import expect from 'expect';
describe('<Plugin />', () => {
it('Expect to have unit tests specified', () => {
expect(true).toEqual(false);
expect(true).toEqual(true);
});
});

View File

@ -19,13 +19,14 @@ export class Content extends React.Component { // eslint-disable-line react/pref
if (this.props.params.plugin === p.id) {
plugin = p;
}
return p;
});
let content;
if (!this.props.params.plugin) {
content = <p>Home</p>
content = <p>Home</p>;
} else if (!plugin) {
content = <p>Unknown plugin.</p>
content = <p>Unknown plugin.</p>;
} else {
const Elem = plugin.mainComponent;
content = <Elem plugin={plugin}></Elem>;
@ -42,6 +43,7 @@ export class Content extends React.Component { // eslint-disable-line react/pref
Content.propTypes = {
plugins: React.PropTypes.object,
onRegisterPluginClicked: React.PropTypes.func,
params: React.PropTypes.func,
};
const mapStateToProps = createSelector(

View File

@ -3,7 +3,7 @@ const path = require('path');
const webpack = require('webpack');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const ExtractTextPlugin = require('extract-text-webpack-plugin');
const OfflinePlugin = require('offline-plugin');
// const OfflinePlugin = require('offline-plugin');
// PostCSS plugins
const cssnext = require('postcss-cssnext');
@ -20,6 +20,7 @@ module.exports = require('./webpack.base.babel')({
output: {
filename: '[name].[chunkhash].js',
chunkFilename: '[name].[chunkhash].chunk.js',
publicPath: '',
},
// We use ExtractTextPlugin so we get a seperate SCSS file instead
@ -81,27 +82,27 @@ module.exports = require('./webpack.base.babel')({
// Put it in the end to capture all the HtmlWebpackPlugin's
// assets manipulations and do leak its manipulations to HtmlWebpackPlugin
new OfflinePlugin({
relativePaths: false,
publicPath: '/',
// No need to cache .htaccess. See http://mxs.is/googmp,
// this is applied before any match in `caches` section
excludes: ['.htaccess'],
caches: {
main: [':rest:'],
// All chunks marked as `additional`, loaded after main section
// and do not prevent SW to install. Change to `optional` if
// do not want them to be preloaded at all (cached only when first loaded)
additional: ['*.chunk.js'],
},
// Removes warning for about `additional` section usage
safeToUseOptionalCaches: true,
AppCache: false,
}),
// new OfflinePlugin({
// relativePaths: false,
// publicPath: '/',
//
// // No need to cache .htaccess. See http://mxs.is/googmp,
// // this is applied before any match in `caches` section
// excludes: ['.htaccess'],
//
// caches: {
// main: [':rest:'],
//
// // All chunks marked as `additional`, loaded after main section
// // and do not prevent SW to install. Change to `optional` if
// // do not want them to be preloaded at all (cached only when first loaded)
// additional: ['*.chunk.js'],
// },
//
// // Removes warning for about `additional` section usage
// safeToUseOptionalCaches: true,
//
// AppCache: false,
// }),
],
});