Clean up before trying webpack2
This commit is contained in:
Родитель
81b0660a62
Коммит
2d560aeb97
|
@ -1,6 +1,5 @@
|
|||
flow-typed/*
|
||||
static/*
|
||||
webpack/*
|
||||
|
||||
server.babel.js
|
||||
tests.webpack.js
|
||||
|
|
|
@ -1,26 +1,74 @@
|
|||
var path = require('path')
|
||||
const path = require('path')
|
||||
const WebpackIsomorphicToolsPlugin = require('webpack-isomorphic-tools/plugin')
|
||||
|
||||
module.exports = {
|
||||
const isomorphicTools = require('./isomorphic-tools')
|
||||
|
||||
const webpackIsomorphicToolsPlugin = new WebpackIsomorphicToolsPlugin(isomorphicTools)
|
||||
|
||||
|
||||
const loaders = [
|
||||
{
|
||||
test: /\.(js|jsx)$/,
|
||||
loader: 'babel',
|
||||
exclude: /node_modules/,
|
||||
},
|
||||
{
|
||||
test: /\.json$/,
|
||||
loader: 'json-loader',
|
||||
},
|
||||
{
|
||||
test: /\.woff(\?v=\d+\.\d+\.\d+)?$/,
|
||||
loader: 'url?limit=10000&mimetype=application/font-woff',
|
||||
},
|
||||
{
|
||||
test: /\.woff2(\?v=\d+\.\d+\.\d+)?$/,
|
||||
loader: 'url?limit=10000&mimetype=application/font-woff',
|
||||
},
|
||||
{
|
||||
test: /\.ttf(\?v=\d+\.\d+\.\d+)?$/,
|
||||
loader: 'url?limit=10000&mimetype=application/octet-stream',
|
||||
},
|
||||
{
|
||||
test: /\.eot(\?v=\d+\.\d+\.\d+)?$/,
|
||||
loader: 'file',
|
||||
},
|
||||
{
|
||||
test: /\.svg(\?v=\d+\.\d+\.\d+)?$/,
|
||||
loader: 'url?limit=10000&mimetype=image/svg+xml',
|
||||
},
|
||||
{
|
||||
test: webpackIsomorphicToolsPlugin.regular_expression('images'),
|
||||
loader: 'url-loader?limit=10240',
|
||||
},
|
||||
]
|
||||
|
||||
const config = {
|
||||
context: path.resolve(__dirname, '..'),
|
||||
node: {
|
||||
fs: "empty"
|
||||
fs: 'empty',
|
||||
},
|
||||
progress: true,
|
||||
resolve: {
|
||||
root: path.resolve(__dirname),
|
||||
modulesDirectories: [
|
||||
'src',
|
||||
'node_modules'
|
||||
'node_modules',
|
||||
],
|
||||
extensions: ['', '.json', '.js', '.jsx'],
|
||||
alias: {
|
||||
'containers': 'containers',
|
||||
'components': 'components',
|
||||
'ducks': 'ducks',
|
||||
'sagas': 'sagas',
|
||||
'services': 'services',
|
||||
containers: 'containers',
|
||||
components: 'components',
|
||||
ducks: 'ducks',
|
||||
sagas: 'sagas',
|
||||
services: 'services',
|
||||
'graphql-queries': 'api/graphql/queries',
|
||||
'universal': 'universal'
|
||||
}
|
||||
}
|
||||
universal: 'universal',
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
config,
|
||||
loaders,
|
||||
webpackIsomorphicToolsPlugin,
|
||||
}
|
||||
|
|
|
@ -1,74 +1,40 @@
|
|||
var path = require('path')
|
||||
var webpack = require('webpack')
|
||||
var assetsPath = path.resolve(__dirname, '../static/dist')
|
||||
/* eslint-disable max-len, import/no-extraneous-dependencies */
|
||||
const path = require('path')
|
||||
const webpack = require('webpack')
|
||||
const assetsPath = path.resolve(__dirname, '../static/dist')
|
||||
|
||||
var host = (process.env.HOST || 'localhost')
|
||||
var port = (+process.env.PORT + 1) || 3001
|
||||
const host = (process.env.HOST || 'localhost')
|
||||
const port = (+process.env.PORT + 1) || 3001
|
||||
|
||||
var WebpackIsomorphicToolsPlugin = require('webpack-isomorphic-tools/plugin')
|
||||
var webpackIsomorphicToolsPlugin = new WebpackIsomorphicToolsPlugin(require('./isomorphic-tools'))
|
||||
const baseConfig = require('./config.base')
|
||||
|
||||
var baseConfig = require('./config.base')
|
||||
|
||||
module.exports = Object.assign({}, baseConfig, {
|
||||
module.exports = Object.assign({}, baseConfig.config, {
|
||||
devtool: 'inline-source-map',
|
||||
entry: {
|
||||
'main': [
|
||||
'webpack-hot-middleware/client?path=http://' + host + ':' + port + '/__webpack_hmr',
|
||||
main: [
|
||||
`webpack-hot-middleware/client?path=http://${host}:${port}/__webpack_hmr`,
|
||||
'bootstrap-sass!./src/theme/bootstrap.config.js',
|
||||
'font-awesome-webpack!./src/theme/font-awesome.config.js',
|
||||
'./src/app.js'
|
||||
]
|
||||
'./src/app.js',
|
||||
],
|
||||
},
|
||||
output: {
|
||||
path: assetsPath,
|
||||
filename: '[name]-[hash].js',
|
||||
chunkFilename: '[name]-[chunkhash].js',
|
||||
publicPath: 'http://' + host + ':' + port + '/dist/'
|
||||
publicPath: `http://${host}:${port}/dist/`,
|
||||
},
|
||||
module: {
|
||||
loaders: [{
|
||||
test: /\.(js|jsx)$/,
|
||||
loader: 'babel',
|
||||
exclude: /node_modules/,
|
||||
},
|
||||
{
|
||||
test: /\.json$/,
|
||||
loader: 'json-loader'
|
||||
},
|
||||
loaders: baseConfig.loaders.concat([
|
||||
{
|
||||
test: /\.scss$/,
|
||||
loader: 'style!css?modules&importLoaders=2&sourceMap&localIdentName=[local]___[hash:base64:5]!autoprefixer?browsers=last 2 version!sass?outputStyle=expanded&sourceMap'
|
||||
loader: 'style!css?modules&importLoaders=2&sourceMap&localIdentName=[local]___[hash:base64:5]!autoprefixer?browsers=last 2 version!sass?outputStyle=expanded&sourceMap',
|
||||
},
|
||||
{
|
||||
test: /\.css$/,
|
||||
loader: 'style!css?localIdentName=[local]___[hash:base64:5]'
|
||||
loader: 'style!css?localIdentName=[local]___[hash:base64:5]',
|
||||
},
|
||||
{
|
||||
test: /\.woff(\?v=\d+\.\d+\.\d+)?$/,
|
||||
loader: 'url?limit=10000&mimetype=application/font-woff'
|
||||
},
|
||||
{
|
||||
test: /\.woff2(\?v=\d+\.\d+\.\d+)?$/,
|
||||
loader: 'url?limit=10000&mimetype=application/font-woff'
|
||||
},
|
||||
{
|
||||
test: /\.ttf(\?v=\d+\.\d+\.\d+)?$/,
|
||||
loader: 'url?limit=10000&mimetype=application/octet-stream'
|
||||
},
|
||||
{
|
||||
test: /\.eot(\?v=\d+\.\d+\.\d+)?$/,
|
||||
loader: 'file'
|
||||
},
|
||||
{
|
||||
test: /\.svg(\?v=\d+\.\d+\.\d+)?$/,
|
||||
loader: 'url?limit=10000&mimetype=image/svg+xml'
|
||||
},
|
||||
{
|
||||
test: webpackIsomorphicToolsPlugin.regular_expression('images'),
|
||||
loader: 'url-loader?limit=10240'
|
||||
},
|
||||
]
|
||||
]),
|
||||
},
|
||||
plugins: [
|
||||
new webpack.HotModuleReplacementPlugin(),
|
||||
|
@ -78,6 +44,6 @@ module.exports = Object.assign({}, baseConfig, {
|
|||
__SERVER__: false,
|
||||
__DEVELOPMENT__: true,
|
||||
}),
|
||||
webpackIsomorphicToolsPlugin.development()
|
||||
]
|
||||
baseConfig.webpackIsomorphicToolsPlugin.development(),
|
||||
],
|
||||
})
|
||||
|
|
|
@ -1,87 +1,54 @@
|
|||
var path = require('path')
|
||||
var webpack = require('webpack')
|
||||
var CleanPlugin = require('clean-webpack-plugin')
|
||||
var ExtractTextPlugin = require('extract-text-webpack-plugin')
|
||||
var strip = require('strip-loader')
|
||||
var LodashModuleReplacementPlugin = require('lodash-webpack-plugin');
|
||||
/* eslint-disable max-len, import/no-extraneous-dependencies */
|
||||
|
||||
var projectRootPath = path.resolve(__dirname, '../')
|
||||
var assetsPath = path.resolve(projectRootPath, './static/dist')
|
||||
const path = require('path')
|
||||
const webpack = require('webpack')
|
||||
const CleanPlugin = require('clean-webpack-plugin')
|
||||
const ExtractTextPlugin = require('extract-text-webpack-plugin')
|
||||
const LodashModuleReplacementPlugin = require('lodash-webpack-plugin')
|
||||
|
||||
var WebpackIsomorphicToolsPlugin = require('webpack-isomorphic-tools/plugin')
|
||||
var webpackIsomorphicToolsPlugin = new WebpackIsomorphicToolsPlugin(require('./isomorphic-tools'))
|
||||
var baseConfig = require('./config.base')
|
||||
const projectRootPath = path.resolve(__dirname, '../')
|
||||
const assetsPath = path.resolve(projectRootPath, './static/dist')
|
||||
|
||||
module.exports = Object.assign({}, baseConfig, {
|
||||
const baseConfig = require('./config.base')
|
||||
|
||||
module.exports = Object.assign({}, baseConfig.config, {
|
||||
devtool: 'source-map',
|
||||
entry: {
|
||||
'main': [
|
||||
main: [
|
||||
'bootstrap-sass!./src/theme/bootstrap.config.prod.js',
|
||||
'font-awesome-webpack!./src/theme/font-awesome.config.prod.js',
|
||||
'./src/app.js'
|
||||
]
|
||||
'./src/app.js',
|
||||
],
|
||||
},
|
||||
output: {
|
||||
path: assetsPath,
|
||||
filename: '[name]-[chunkhash].js',
|
||||
chunkFilename: '[name]-[chunkhash].js',
|
||||
publicPath: '/dist/'
|
||||
publicPath: '/dist/',
|
||||
},
|
||||
module: {
|
||||
loaders: [{
|
||||
test: /\.(js|jsx)$/,
|
||||
exclude: /node_modules/,
|
||||
loaders: [strip.loader('debug'), 'babel']
|
||||
},
|
||||
{
|
||||
test: /\.json$/,
|
||||
loader: 'json-loader'
|
||||
},
|
||||
loaders: baseConfig.loaders.concat([
|
||||
{
|
||||
test: /\.scss$/,
|
||||
loader: ExtractTextPlugin.extract('style', 'css?modules&importLoaders=2&sourceMap!autoprefixer?browsers=last 2 version!sass?outputStyle=expanded&sourceMap=true&sourceMapContents=true')
|
||||
loader: ExtractTextPlugin.extract('style', 'css?modules&importLoaders=2&sourceMap!autoprefixer?browsers=last 2 version!sass?outputStyle=expanded&sourceMap=true&sourceMapContents=true'),
|
||||
},
|
||||
{
|
||||
test: /\.css$/,
|
||||
loader: ExtractTextPlugin.extract('style', 'css!autoprefixer')
|
||||
loader: ExtractTextPlugin.extract('style', 'css!autoprefixer'),
|
||||
},
|
||||
{
|
||||
test: /\.woff(\?v=\d+\.\d+\.\d+)?$/,
|
||||
loader: 'url?limit=10000&mimetype=application/font-woff'
|
||||
},
|
||||
{
|
||||
test: /\.woff2(\?v=\d+\.\d+\.\d+)?$/,
|
||||
loader: 'url?limit=10000&mimetype=application/font-woff'
|
||||
},
|
||||
{
|
||||
test: /\.ttf(\?v=\d+\.\d+\.\d+)?$/,
|
||||
loader: 'url?limit=10000&mimetype=application/octet-stream'
|
||||
},
|
||||
{
|
||||
test: /\.eot(\?v=\d+\.\d+\.\d+)?$/,
|
||||
loader: 'file'
|
||||
},
|
||||
{
|
||||
test: /\.svg(\?v=\d+\.\d+\.\d+)?$/,
|
||||
loader: 'url?limit=10000&mimetype=image/svg+xml'
|
||||
},
|
||||
{
|
||||
test: webpackIsomorphicToolsPlugin.regular_expression('images'),
|
||||
loader: 'url-loader?limit=10240'
|
||||
},
|
||||
]
|
||||
]),
|
||||
},
|
||||
plugins: [
|
||||
new LodashModuleReplacementPlugin(),
|
||||
new CleanPlugin([assetsPath], {
|
||||
root: projectRootPath
|
||||
root: projectRootPath,
|
||||
}),
|
||||
new ExtractTextPlugin('[name]-[chunkhash].css', {
|
||||
allChunks: true
|
||||
allChunks: true,
|
||||
}),
|
||||
new webpack.DefinePlugin({
|
||||
'process.env': {
|
||||
NODE_ENV: '"production"'
|
||||
NODE_ENV: '"production"',
|
||||
},
|
||||
|
||||
__CLIENT__: true,
|
||||
|
@ -94,10 +61,10 @@ module.exports = Object.assign({}, baseConfig, {
|
|||
new webpack.optimize.OccurenceOrderPlugin(),
|
||||
new webpack.optimize.UglifyJsPlugin({
|
||||
compress: {
|
||||
warnings: false
|
||||
}
|
||||
warnings: false,
|
||||
},
|
||||
}),
|
||||
|
||||
webpackIsomorphicToolsPlugin
|
||||
]
|
||||
baseConfig.webpackIsomorphicToolsPlugin,
|
||||
],
|
||||
})
|
||||
|
|
|
@ -1,58 +1,25 @@
|
|||
require('babel-polyfill')
|
||||
|
||||
var path = require('path')
|
||||
|
||||
var nodeExternals = require('webpack-node-externals')
|
||||
var babelLoader = require('./dev.babel')
|
||||
var config = babelLoader('./.babelrc')
|
||||
/* eslint-disable max-len, import/no-extraneous-dependencies */
|
||||
const nodeExternals = require('webpack-node-externals')
|
||||
|
||||
require('source-map-support').install({
|
||||
environment: 'node',
|
||||
})
|
||||
|
||||
var baseConfig = require('./config.base')
|
||||
const baseConfig = require('./config.base')
|
||||
|
||||
module.exports = Object.assign({}, baseConfig, {
|
||||
module.exports = Object.assign({}, baseConfig.config, {
|
||||
target: 'node',
|
||||
externals: [nodeExternals()],
|
||||
module: {
|
||||
loaders: [{
|
||||
test: /\.(js|jsx)$/,
|
||||
exclude: /node_modules/,
|
||||
loaders: ['babel?' + JSON.stringify(config), 'eslint-loader']
|
||||
},
|
||||
{
|
||||
test: /\.json$/,
|
||||
loader: 'json-loader'
|
||||
},
|
||||
loaders: baseConfig.loaders.concat([
|
||||
{
|
||||
test: /\.scss$/,
|
||||
loader: 'style!css?modules&importLoaders=2&sourceMap&localIdentName=[local]___[hash:base64:5]!autoprefixer?browsers=last 2 version!sass?outputStyle=expanded&sourceMap'
|
||||
loader: 'style!css?modules&importLoaders=2&sourceMap&localIdentName=[local]___[hash:base64:5]!autoprefixer?browsers=last 2 version!sass?outputStyle=expanded&sourceMap',
|
||||
},
|
||||
{
|
||||
test: /\.css$/,
|
||||
loader: 'style!css?localIdentName=[local]___[hash:base64:5]'
|
||||
loader: 'style!css?localIdentName=[local]___[hash:base64:5]',
|
||||
},
|
||||
{
|
||||
test: /\.woff(\?v=\d+\.\d+\.\d+)?$/,
|
||||
loader: 'url?limit=10000&mimetype=application/font-woff'
|
||||
},
|
||||
{
|
||||
test: /\.woff2(\?v=\d+\.\d+\.\d+)?$/,
|
||||
loader: 'url?limit=10000&mimetype=application/font-woff'
|
||||
},
|
||||
{
|
||||
test: /\.ttf(\?v=\d+\.\d+\.\d+)?$/,
|
||||
loader: 'url?limit=10000&mimetype=application/octet-stream'
|
||||
},
|
||||
{
|
||||
test: /\.eot(\?v=\d+\.\d+\.\d+)?$/,
|
||||
loader: 'file'
|
||||
},
|
||||
{
|
||||
test: /\.svg(\?v=\d+\.\d+\.\d+)?$/,
|
||||
loader: 'url?limit=10000&mimetype=image/svg+xml'
|
||||
},
|
||||
]
|
||||
}
|
||||
]),
|
||||
},
|
||||
})
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
/* eslint-disable */
|
||||
var WebpackIsomorphicToolsPlugin = require('webpack-isomorphic-tools/plugin');
|
||||
|
||||
module.exports = {
|
||||
|
|
|
@ -1,14 +1,15 @@
|
|||
var Express = require('express')
|
||||
var webpack = require('webpack')
|
||||
/* eslint-disable */
|
||||
const Express = require('express')
|
||||
const webpack = require('webpack')
|
||||
|
||||
var env = require('../src/config')
|
||||
var webpackConfig = require('./config.dev')
|
||||
var compiler = webpack(webpackConfig)
|
||||
const env = require('../src/config')
|
||||
const webpackConfig = require('./config.dev')
|
||||
const compiler = webpack(webpackConfig)
|
||||
|
||||
var host = env.HOST || 'localhost'
|
||||
var port = (Number(env.PORT) + 1) || 3001
|
||||
var serverOptions = {
|
||||
contentBase: 'http://' + host + ':' + port,
|
||||
const host = env.HOST || 'localhost'
|
||||
const port = (Number(env.PORT) + 1) || 3001
|
||||
const serverOptions = {
|
||||
contentBase: `http://${host}:${port}`,
|
||||
quiet: true,
|
||||
noInfo: true,
|
||||
hot: true,
|
||||
|
@ -16,14 +17,14 @@ var serverOptions = {
|
|||
lazy: false,
|
||||
publicPath: webpackConfig.output.publicPath,
|
||||
headers: { 'Access-Control-Allow-Origin': '*' },
|
||||
stats: { colors: true }
|
||||
stats: { colors: true },
|
||||
}
|
||||
var app = new Express()
|
||||
const app = new Express()
|
||||
|
||||
app.use(require('webpack-dev-middleware')(compiler, serverOptions))
|
||||
app.use(require('webpack-hot-middleware')(compiler))
|
||||
|
||||
app.listen(port, function onAppListening(err) {
|
||||
app.listen(port, (err) => {
|
||||
if (err) {
|
||||
console.error(err)
|
||||
} else {
|
||||
|
|
Загрузка…
Ссылка в новой задаче