-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
different conficuration for babel, separate script for building intl …
…messages
- Loading branch information
1 parent
e05fdd1
commit 615a0dc
Showing
4 changed files
with
136 additions
and
80 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,30 @@ | ||
{ | ||
"presets": ["es2015", "react"], | ||
"plugins": [ | ||
"add-module-exports", | ||
"transform-object-rest-spread", | ||
"transform-class-properties", | ||
"syntax-decorators", | ||
"transform-react-constant-elements", | ||
"transform-react-inline-elements", | ||
["react-intl", { | ||
"messagesDir": "./build/messages/" | ||
}], | ||
] | ||
"env": { | ||
"production": { | ||
"plugins": [ | ||
"add-module-exports", | ||
"transform-object-rest-spread", | ||
"transform-class-properties", | ||
"syntax-decorators", | ||
"transform-react-constant-elements", | ||
"transform-react-inline-elements", | ||
["react-intl", { | ||
"messagesDir": "./build/messages/" | ||
}] | ||
] | ||
}, | ||
"development": { | ||
"plugins": [ | ||
"add-module-exports", | ||
"transform-object-rest-spread", | ||
"transform-class-properties", | ||
"transform-react-constant-elements", | ||
"syntax-decorators", | ||
["react-intl", { | ||
"messagesDir": "./build/messages/" | ||
}], | ||
], | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,105 @@ | ||
let webpack = require('webpack'); | ||
let path = require('path'); | ||
let StatsWriterPlugin = require('webpack-stats-plugin').StatsWriterPlugin; | ||
let Visualizer = require('webpack-visualizer-plugin'); | ||
let ExtractTextPlugin = require('extract-text-webpack-plugin'); | ||
let ReactIntlPlugin = require('react-intl-webpack-plugin'); | ||
|
||
let webpackConfig = { | ||
resolve: { | ||
extensions: ['.js'] | ||
}, | ||
entry: { | ||
main: [ | ||
'./client.js' | ||
], | ||
vendor: [ | ||
'react-intl', 'react', 'react-dom', 'semantic-ui-react', 'react-hotkeys', 'react-list', 'react-responsive', 'react-custom-scrollbars', 'react-resize-aware', 'async', 'immutable', 'classnames', 'fluxible', 'fluxible-addons-react', 'fluxible-plugin-fetchr', 'fluxible-router', 'react-google-recaptcha', 'identicons-react', 'iso-639-1', 'lodash', 'cheerio', 'react-dnd', 'react-dnd-html5-backend', 'striptags', 'js-sha512', 'debug', 'md5', 'js-cookie', 'cookie', 'fumble', 'crypt' | ||
] | ||
}, | ||
output: { | ||
path: path.resolve('./build/js'), | ||
publicPath: '/public/js/', | ||
filename: '[name].js' | ||
}, | ||
module: { | ||
rules: [ | ||
{ | ||
test: /\.(js|jsx)$/, | ||
exclude: /node_modules\/(?!identicons)/ , | ||
loader: 'babel-loader' | ||
}, | ||
// Getting URLs for font files otherwise we get encoding errors in css-loader | ||
{ test : /\.(ttf|eot|svg|woff(2)?)(\?[a-z0-9=&.]+)?$/, loader: 'file-loader'},// 'url-loader?limit=100000'}, | ||
{ | ||
test: /\.css$/, | ||
exclude: /\.(ttf|eot|svg|woff(2)?)(\?[a-z0-9=&.]+)?$/, | ||
loader: ExtractTextPlugin.extract({ | ||
fallback: 'style-loader', | ||
use: [ | ||
'css-loader?modules&importLoaders=1&localIdentName=[hash:base64:5]' | ||
], | ||
// use: 'css-loader', | ||
// options: {importLoaders: 1, modules: true}, | ||
publicPath: '/public/css/' | ||
}) | ||
}, | ||
// { test: /\.css$/, | ||
// use: [ | ||
// { | ||
// loader: 'style-loader' | ||
// }, | ||
// { | ||
// loader: 'css-loader' | ||
// } | ||
// ] | ||
// }, | ||
|
||
] | ||
}, | ||
node: { | ||
setImmediate: false | ||
}, | ||
plugins: [ | ||
//collect all messages into one json | ||
new ReactIntlPlugin(), | ||
// css files from the extract-text-plugin loader | ||
new ExtractTextPlugin({ | ||
filename: '../css/vendor.bundle.css', | ||
disable: false, | ||
allChunks: true | ||
}), | ||
|
||
new webpack.DefinePlugin({ | ||
'process.env': { | ||
NODE_ENV: JSON.stringify('production'), | ||
// Mainly used to require CSS files with webpack, which can happen only on browser | ||
// Used as `if (process.env.BROWSER)...` | ||
BROWSER: JSON.stringify(true), | ||
} | ||
}), | ||
new webpack.optimize.UglifyJsPlugin({ | ||
sourceMap: true, | ||
compress: { | ||
warnings: false | ||
} | ||
}), | ||
new webpack.optimize.CommonsChunkPlugin({ | ||
name: 'vendor', | ||
minChunks: Infinity, | ||
filename: '[name].bundle.js' | ||
}), | ||
// Write out stats file to build directory. | ||
new StatsWriterPlugin({ | ||
filename: 'webpack.stats.json', // Default | ||
fields: null, | ||
transform: function (data) { | ||
return JSON.stringify(data, null, 2); | ||
} | ||
}), | ||
new Visualizer() | ||
], | ||
devtool: 'source-map' | ||
}; | ||
|
||
module.exports = webpackConfig; |