Skip to content
This repository was archived by the owner on May 4, 2020. It is now read-only.
Open
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
15 changes: 15 additions & 0 deletions .modernizrrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
// https://github.com/peerigon/modernizr-loader/blob/master/index.js#L25
module.exports = {
"classPrefix": "",
"options": [],
"feature-detects": [
"cookies",
"cors",
"css/all",
"es6/promises",
"history",
"intl",
"network/fetch",
"requestanimationframe"
]
}
2 changes: 2 additions & 0 deletions config/webpack/client.babel.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import {output, plugin} from 'webpack-partial';
import PagesPlugin from 'pages-webpack-plugin';

import base from './partial/base';
import modernizr from './partial/modernizr';

const getRender = () => {
try {
Expand Down Expand Up @@ -32,6 +33,7 @@ const createConfig = compose(
render: getRender(),
}), config);
},
modernizr(),
output({
publicPath: '/asset',
}),
Expand Down
2 changes: 1 addition & 1 deletion config/webpack/partial/babel.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export default () => (config) => {
return [name, {
...config,
modules: false,
useBuiltIns: 'usage',
useBuiltIns: false,
ignoreBrowserslistConfig: target === 'node',
targets: getTargets(target),
include: [
Expand Down
10 changes: 10 additions & 0 deletions config/webpack/partial/env.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,19 @@ const extract = pipe(
const env = (env = {}) => console.log(chalk.bold('📦 Enironment')) ||
plugin(new DefinePlugin(extract(env)));

const isDev = !process.env.NODE_ENV || process.env.NODE_ENV === 'development';

export default () => env({
NODE_ENV: {
value: 'development',
required: true,
},
FORCE_PROMISE_POLYFILL: {
value: isDev ? 'true' : '',
required: false,
},
FORCE_FETCH_POLYFILL: {
value: isDev ? 'true' : '',
required: false,
},
});
15 changes: 15 additions & 0 deletions config/webpack/partial/modernizr.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import {alias, loader} from 'webpack-partial';
import {compose} from 'ramda';
import path from 'path';

export default (rc = '.modernizrrc.js') => compose(
loader({
test: /\.modernizrrc/,
loader: require.resolve('modernizr-loader'),
}),
(config) => alias(
'modernizr$',
rc.charAt(0) === '/' ? rc : path.join(config.context, rc),
config
)
);
6 changes: 6 additions & 0 deletions config/webpack/partial/node.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import nodeExternals from 'webpack-node-externals';
import {compose, assoc} from 'ramda';

export default compose(
assoc('externals', [nodeExternals()]),
);
8 changes: 4 additions & 4 deletions config/webpack/render.babel.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
import {compose} from 'ramda';
import nodeExternals from 'webpack-node-externals';

import {output} from 'webpack-partial';

import base from './partial/base';
import node from './partial/node';

const createConfig = compose(
output({
library: 'render',
libraryTarget: 'commonjs2',
}),
node(),
base({name: 'render', target: 'node'}),
);

export default createConfig({
externals: [nodeExternals()],
});
export default createConfig({});
7 changes: 3 additions & 4 deletions config/webpack/server.babel.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
import nodeExternals from 'webpack-node-externals';
import {compose} from 'ramda';

import base from './partial/base';
import node from './partial/node';

const createConfig = compose(
node(),
base({name: 'server', target: 'node'}),
);

export default createConfig({
externals: [nodeExternals()],
});
export default createConfig({});
Loading