1
0
mirror of https://github.com/yldio/copilot.git synced 2024-12-01 07:30:07 +02:00

s/config/base in webpack config

This commit is contained in:
Sérgio Ramos 2016-10-24 14:13:02 +01:00
parent ada55f14fd
commit 5d74a2d66b
5 changed files with 11 additions and 96 deletions

View File

@ -1,85 +0,0 @@
const ExtractTextPlugin = require('extract-text-webpack-plugin');
const webpack = require('webpack');
const path = require('path');
const plugins = {
'no-errors-plugin': new webpack.NoErrorsPlugin(),
'extract-text-plugin': new ExtractTextPlugin({
filename: '[name].css',
allChunks: true
}),
'loader-options-plugin': new webpack.LoaderOptionsPlugin({
options: {
postcss: {
plugins: () => {
return [
require('postcss-cssnext')
];
}
},
'embed-markdown-loader': {
// don't detach yet (has a bug in the production config)
// webpackConfigFullpath: path.join(__dirname, 'index.js')
}
}
})
};
module.exports = {
context: path.join(__dirname, '../'),
output: {
path: path.join(__dirname, '../static'),
publicPath: '/static/',
filename: '[name].js'
},
plugins: [
plugins['no-errors-plugin'],
plugins['extract-text-plugin'],
plugins['loader-options-plugin']
],
resolveLoader: {
alias: {
'embed-markdown-loader': path.join(__dirname, './embed-markdown-loader')
}
},
module: {
loaders: [{
test: /js?$/,
exclude: /node_modules/,
include: [
path.join(__dirname, '../src'),
path.join(__dirname, '../docs')
],
loader: 'babel'
}, {
test: /\.json?$/,
exclude: /node_modules/,
include: [
path.join(__dirname, '../src'),
path.join(__dirname, '../docs')
],
loader: 'json'
}, {
test: /\.md?$/,
exclude: /node_modules/,
include: [
path.join(__dirname, '../src'),
path.join(__dirname, '../docs')
],
loader: 'html-loader!embed-markdown-loader'
}, {
test: /\.css?$/,
exclude: /node_modules/,
include: [
path.join(__dirname, '../src'),
path.join(__dirname, '../docs')
],
loader: ExtractTextPlugin.extract({
fallbackLoader: 'style-loader',
loader: 'css-loader?modules&importLoaders=1&localIdentName=[name]__[local]___[hash:base64:5]!postcss-loader'
})
}]
}
};
module.exports.__plugins = plugins;

View File

@ -1,5 +1,5 @@
const graphql = require('../../cloudapi-graphql/src/endpoint'); const graphql = require('../../cloudapi-graphql/src/endpoint');
const config = require('./config.js'); const base = require('./base.js');
const entries = require('./entrypoints'); const entries = require('./entrypoints');
const webpack = require('webpack'); const webpack = require('webpack');
@ -16,7 +16,7 @@ const devServer = {
} }
}; };
module.exports = Object.assign(config, { module.exports = Object.assign(base.config, {
entry: entries.reduce((all, entry) => { entry: entries.reduce((all, entry) => {
all[entry.name] = [ all[entry.name] = [
'react-hot-loader/patch', 'react-hot-loader/patch',
@ -27,7 +27,7 @@ module.exports = Object.assign(config, {
return all; return all;
}, {}), }, {}),
plugins: config.plugins.concat([ plugins: base.config.plugins.concat([
new webpack.HotModuleReplacementPlugin() new webpack.HotModuleReplacementPlugin()
]), ]),
devtool: 'source-map', devtool: 'source-map',

View File

@ -2,8 +2,8 @@ const path = require('path');
const fs = require('fs'); const fs = require('fs');
const docs = path.join(__dirname, '../docs/index'); const docs = path.join(__dirname, '../docs/index');
const src = path.join(__dirname, '../src/'); const src = path.join(__dirname, '../src/components');
const ui = path.join(src, './index.js'); const ui = path.join(__dirname, '../src/index.js');
module.exports = fs module.exports = fs
.readdirSync(src) .readdirSync(src)

View File

@ -1,15 +1,15 @@
const WebpackShellPlugin = require('webpack-shell-plugin'); const WebpackShellPlugin = require('webpack-shell-plugin');
const config = require('./config.js'); const base = require('./base.js');
const webpack = require('webpack'); const webpack = require('webpack');
const entries = require('./entrypoints'); const entries = require('./entrypoints');
const path = require('path'); const path = require('path');
module.exports = Object.assign(config, { module.exports = Object.assign(base.config, {
entry: entries.reduce((all, entry) => { entry: entries.reduce((all, entry) => {
all[entry.name] = [entry.path]; all[entry.name] = [entry.path];
return all; return all;
}, {}), }, {}),
plugins: config.plugins.concat([ plugins: base.config.plugins.concat([
new webpack.optimize.DedupePlugin(), new webpack.optimize.DedupePlugin(),
new webpack.optimize.OccurrenceOrderPlugin(true), new webpack.optimize.OccurrenceOrderPlugin(true),
new webpack.optimize.UglifyJsPlugin(), new webpack.optimize.UglifyJsPlugin(),

View File

@ -1,4 +1,4 @@
const config = require('./config'); const base = require('./base');
const webpack = require('webpack'); const webpack = require('webpack');
const path = require('path'); const path = require('path');
@ -7,8 +7,8 @@ module.exports = {
libraryTarget: 'commonjs2' libraryTarget: 'commonjs2'
}, },
plugins: [ plugins: [
config.__plugins['no-errors-plugin'], base.plugins['no-errors-plugin'],
config.__plugins['loader-options-plugin'] base.plugins['loader-options-plugin']
], ],
module: { module: {
loaders: [{ loaders: [{