diff --git a/ui/webpack/config.js b/ui/webpack/config.js deleted file mode 100644 index 41b579e0..00000000 --- a/ui/webpack/config.js +++ /dev/null @@ -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; diff --git a/ui/webpack/development.js b/ui/webpack/development.js index 457c6c15..f69eec61 100644 --- a/ui/webpack/development.js +++ b/ui/webpack/development.js @@ -1,5 +1,5 @@ const graphql = require('../../cloudapi-graphql/src/endpoint'); -const config = require('./config.js'); +const base = require('./base.js'); const entries = require('./entrypoints'); 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) => { all[entry.name] = [ 'react-hot-loader/patch', @@ -27,7 +27,7 @@ module.exports = Object.assign(config, { return all; }, {}), - plugins: config.plugins.concat([ + plugins: base.config.plugins.concat([ new webpack.HotModuleReplacementPlugin() ]), devtool: 'source-map', diff --git a/ui/webpack/entrypoints.js b/ui/webpack/entrypoints.js index 04228565..103424b3 100644 --- a/ui/webpack/entrypoints.js +++ b/ui/webpack/entrypoints.js @@ -2,8 +2,8 @@ const path = require('path'); const fs = require('fs'); const docs = path.join(__dirname, '../docs/index'); -const src = path.join(__dirname, '../src/'); -const ui = path.join(src, './index.js'); +const src = path.join(__dirname, '../src/components'); +const ui = path.join(__dirname, '../src/index.js'); module.exports = fs .readdirSync(src) diff --git a/ui/webpack/production.js b/ui/webpack/production.js index d6054485..4b3d924a 100644 --- a/ui/webpack/production.js +++ b/ui/webpack/production.js @@ -1,15 +1,15 @@ const WebpackShellPlugin = require('webpack-shell-plugin'); -const config = require('./config.js'); +const base = require('./base.js'); const webpack = require('webpack'); const entries = require('./entrypoints'); const path = require('path'); -module.exports = Object.assign(config, { +module.exports = Object.assign(base.config, { entry: entries.reduce((all, entry) => { all[entry.name] = [entry.path]; return all; }, {}), - plugins: config.plugins.concat([ + plugins: base.config.plugins.concat([ new webpack.optimize.DedupePlugin(), new webpack.optimize.OccurrenceOrderPlugin(true), new webpack.optimize.UglifyJsPlugin(), diff --git a/ui/webpack/test.js b/ui/webpack/test.js index 6287fd8e..3de7c020 100644 --- a/ui/webpack/test.js +++ b/ui/webpack/test.js @@ -1,4 +1,4 @@ -const config = require('./config'); +const base = require('./base'); const webpack = require('webpack'); const path = require('path'); @@ -7,8 +7,8 @@ module.exports = { libraryTarget: 'commonjs2' }, plugins: [ - config.__plugins['no-errors-plugin'], - config.__plugins['loader-options-plugin'] + base.plugins['no-errors-plugin'], + base.plugins['loader-options-plugin'] ], module: { loaders: [{