Skip to content

Commit

Permalink
(core,react) Fix webpack2 support (#379) and restructure node_modules…
Browse files Browse the repository at this point in the history
… setup for dev mode

* upgrade packages

* tmp

* upgrade to latest betas

* re-add hot reloading dedection support

* restructure depedencies

* remove legacy autoprefixer package

* cleanup example webpack configs

* fix flowconfig by ignoring radium

* run react plugin build after npm install

* disable linting for library example import

* use latest extra entry webpack plugin
  • Loading branch information
nikgraf committed Jul 16, 2016
1 parent 0cedc40 commit fdcb99d
Show file tree
Hide file tree
Showing 19 changed files with 35 additions and 116 deletions.
1 change: 1 addition & 0 deletions .flowconfig
Expand Up @@ -5,6 +5,7 @@
.*/node_modules/config-chain/.*
.*/node_modules/npmconf/.*
.*/node_modules/jsonlint/.*
.*/node_modules/radium/.*

[include]

Expand Down
5 changes: 0 additions & 5 deletions client/webpack.dev.babel.js
Expand Up @@ -20,11 +20,6 @@ export default {
filename: 'carte-blanche/index.html',
template: '!!html!' + path.join(__dirname, './index.html'), // eslint-disable-line
}),
new webpack.DefinePlugin({
'process.env': {
DISABLE_LOGGER: process.env.DISABLE_LOGGER,
},
}),
],
module: {
loaders: [
Expand Down
7 changes: 5 additions & 2 deletions client/webpack.prod.babel.js
Expand Up @@ -20,7 +20,7 @@ export default {
PRODUCTION: process.env.PRODUCTION,
},
}),
new ExtractTextPlugin('[name].css?[hash]', { allChunks: true }),
new ExtractTextPlugin({ filename: '[name].css?[hash]', allChunks: true }),
],
module: {
loaders: [
Expand All @@ -30,7 +30,10 @@ export default {
exclude: /node_modules/,
}, {
test: /\.css$/,
loader: xt('style', 'css?modules&importLoaders=1!postcss-loader'),
loader: xt({
notExtractLoader: 'style-loader',
loader: 'css-loader?modules&importLoaders=1!postcss-loader',
}),
},
],
},
Expand Down
5 changes: 0 additions & 5 deletions examples/commons/webpack.dev.babel.js
Expand Up @@ -19,11 +19,6 @@ export default {
plugins: [
// new webpack.HotModuleReplacementPlugin(),
new webpack.NoErrorsPlugin(),
new webpack.DefinePlugin({
'process.env': {
DISABLE_LOGGER: process.env.DISABLE_LOGGER,
},
}),
new HtmlWebpackPlugin({
inject: true,
template: path.join(__dirname, './src/index.html'),
Expand Down
14 changes: 5 additions & 9 deletions examples/dest/webpack.dev.babel.js
Expand Up @@ -20,12 +20,7 @@ export default {
plugins: [
// new webpack.HotModuleReplacementPlugin(),
new webpack.NoErrorsPlugin(),
new webpack.DefinePlugin({
'process.env': {
DISABLE_LOGGER: process.env.DISABLE_LOGGER,
},
}),
new ExtractTextPlugin('bundle-[hash].css', { disable: true }),
new ExtractTextPlugin({ filename: 'bundle-[hash].css', disable: true }),
new HtmlWebpackPlugin({
inject: true,
template: path.join(__dirname, './src/index.html'),
Expand All @@ -50,9 +45,10 @@ export default {
path.join(__dirname, '../../plugins'),
],
}, {
test: /\.css/,
loader: ExtractTextPlugin.extract('style',
'css?modules&importLoaders=1&localIdentName=[name]-[local]!postcss-loader'),
loader: ExtractTextPlugin.extract({
notExtractLoader: 'style-loader',
loader: 'css-loader?modules&importLoaders=1&localIdentName=[name]-[local]!postcss-loader',
}),
include: [
path.join(__dirname, './src'),
path.join(__dirname, '../../webpack-plugin'),
Expand Down
5 changes: 0 additions & 5 deletions examples/dev/webpack.dev.babel.js
Expand Up @@ -21,11 +21,6 @@ export default {
plugins: [
// new webpack.HotModuleReplacementPlugin(),
new webpack.NoErrorsPlugin(),
new webpack.DefinePlugin({
'process.env': {
DISABLE_LOGGER: process.env.DISABLE_LOGGER,
},
}),
new HtmlWebpackPlugin({
inject: true,
template: path.join(__dirname, './src/index.html'),
Expand Down
5 changes: 3 additions & 2 deletions examples/express/package.json
Expand Up @@ -11,14 +11,15 @@
"license": "MIT",
"dependencies": {
"express": "^4.13.4",
"webpack": "^1.13.1",
"webpack": ">=1 <3 || ^2.1.0-beta",
"webpack-dev-middleware": "^1.6.1",
"webpack-hot-middleware": "^2.10.0"
},
"devDependencies": {
"autoprefixer": "^6.3.6",
"babel-loader": "^6.2.4",
"html-webpack-plugin": "^2.19.0",
"react-hot-loader": "^1.3.0"
"react-hot-loader": "^1.3.0",
"webpack": "^2.1.0-beta.18"
}
}
5 changes: 0 additions & 5 deletions examples/express/webpack.dev.babel.js
Expand Up @@ -19,11 +19,6 @@ module.exports = {
plugins: [
new webpack.HotModuleReplacementPlugin(),
new webpack.NoErrorsPlugin(),
new webpack.DefinePlugin({
'process.env': {
DISABLE_LOGGER: process.env.DISABLE_LOGGER,
},
}),
new HtmlWebpackPlugin({
inject: true,
template: path.join(__dirname, './src/index.html'),
Expand Down
2 changes: 1 addition & 1 deletion examples/library/package.json
Expand Up @@ -14,7 +14,7 @@
},
"devDependencies": {
"babel-loader": "^6.2.4",
"webpack-dev-server": "^1.14.1"
"webpack-dev-server": "^2.1.0-beta.0"
},
"scripts": {
"test": "mocha"
Expand Down
1 change: 1 addition & 0 deletions examples/library/webpack.config.js
Expand Up @@ -2,6 +2,7 @@ const path = require('path');
const webpack = require('webpack');

// To use the dev version, rename this file to webpack.config.babel.js (the .babel is missing atm)
// eslint-disable-next-line import/no-unresolved
const CarteBlanche = require('../../webpack-plugin/dist/index');

const commonEntrypoints = [
Expand Down
21 changes: 0 additions & 21 deletions examples/profile/webpack.dev.babel.js
Expand Up @@ -2,7 +2,6 @@ import path from 'path';
import webpack from 'webpack';
import HtmlWebpackPlugin from 'html-webpack-plugin';
import CarteBlanche from '../../webpack-plugin/index';
import autoprefixer from 'autoprefixer';

export default {
devtool: 'inline-source-map',
Expand All @@ -12,18 +11,11 @@ export default {
publicPath: '/',
},
entry: [
'webpack-dev-server/client',
'webpack/hot/only-dev-server',
path.join(__dirname, './src/index.js'),
],
plugins: [
// new webpack.HotModuleReplacementPlugin(),
new webpack.NoErrorsPlugin(),
new webpack.DefinePlugin({
'process.env': {
DISABLE_LOGGER: process.env.DISABLE_LOGGER,
},
}),
new HtmlWebpackPlugin({
inject: true,
template: path.join(__dirname, './src/index.html'),
Expand All @@ -38,22 +30,9 @@ export default {
test: /\.js$/,
loaders: ['react-hot', 'babel'],
exclude: /node_modules/,
}, {
test: /\.css/,
loader: 'style!css?modules&importLoaders=1&localIdentName=[local]__[path][name]__[hash:base64:5]!postcss-loader', // eslint-disable-line max-len
}, {
test: /\.(png|jpg|gif)$/,
loaders: ['url?limit=10000'],
}, {
test: /\.(svg)$/,
loaders: ['url?limit=0'],
}, {
test: /\.(json)$/,
loader: 'json',
},
],
},
postcss: [autoprefixer({ browsers: ['last 2 versions'] })],
devServer: {
// It suppress error shown in console, so it has to be set to false.
quiet: false,
Expand Down
5 changes: 0 additions & 5 deletions examples/styling/aphrodite/webpack.dev.babel.js
Expand Up @@ -19,11 +19,6 @@ export default {
plugins: [
// new webpack.HotModuleReplacementPlugin(),
new webpack.NoErrorsPlugin(),
new webpack.DefinePlugin({
'process.env': {
DISABLE_LOGGER: process.env.DISABLE_LOGGER,
},
}),
new HtmlWebpackPlugin({
inject: true,
template: path.join(__dirname, './src/index.html'),
Expand Down
5 changes: 0 additions & 5 deletions examples/styling/jss/webpack.dev.babel.js
Expand Up @@ -19,11 +19,6 @@ export default {
plugins: [
// new webpack.HotModuleReplacementPlugin(),
new webpack.NoErrorsPlugin(),
new webpack.DefinePlugin({
'process.env': {
DISABLE_LOGGER: process.env.DISABLE_LOGGER,
},
}),
new HtmlWebpackPlugin({
inject: true,
template: path.join(__dirname, './src/index.html'),
Expand Down
5 changes: 0 additions & 5 deletions examples/styling/radium/webpack.dev.babel.js
Expand Up @@ -19,11 +19,6 @@ export default {
plugins: [
// new webpack.HotModuleReplacementPlugin(),
new webpack.NoErrorsPlugin(),
new webpack.DefinePlugin({
'process.env': {
DISABLE_LOGGER: process.env.DISABLE_LOGGER,
},
}),
new HtmlWebpackPlugin({
inject: true,
template: path.join(__dirname, './src/index.html'),
Expand Down
5 changes: 0 additions & 5 deletions examples/users/webpack.dev.babel.js
Expand Up @@ -19,11 +19,6 @@ export default {
],
plugins: [
new webpack.NoErrorsPlugin(),
new webpack.DefinePlugin({
'process.env': {
DISABLE_LOGGER: process.env.DISABLE_LOGGER,
},
}),
new HtmlWebpackPlugin({
inject: true,
template: path.join(__dirname, './src/index.html'),
Expand Down
13 changes: 7 additions & 6 deletions package.json
Expand Up @@ -31,7 +31,7 @@
"node": "5.5.0"
},
"scripts": {
"postinstall": "(cd plugins/react && npm install && cd ../../webpack-plugin && npm install && cd .. && npm run client:build)",
"postinstall": "npm run client:build && npm run plugin:react:build",
"start": "npm run example:dev",
"server": "webpack-dev-server --hot",
"example:dev": "npm run server -- --context examples/dev/ --config examples/dev/webpack.dev.babel.js",
Expand Down Expand Up @@ -68,7 +68,6 @@
"chokidar": "^1.5.1",
"connect-history-api-fallback": "^1.2.0",
"cors": "^2.7.1",
"extra-entry-webpack-plugin": "0.0.2",
"faker": "^3.1.0",
"lodash": "^4.13.1",
"mkdirp": "^0.5.1",
Expand All @@ -88,7 +87,7 @@
},
"devDependencies": {
"aphrodite": "^0.4.0",
"autoprefixer-loader": "^3.2.0",
"axios": "^0.12.0",
"babel": "^6.5.2",
"babel-cli": "^6.9.0",
"babel-core": "^6.9.0",
Expand All @@ -114,7 +113,8 @@
"exenv": "^1.2.1",
"express": "^4.13.4",
"express-http-proxy": "^0.7.2",
"extract-text-webpack-plugin": "^1.0.1",
"extra-entry-webpack-plugin": "0.0.3",
"extract-text-webpack-plugin": "^2.0.0-beta.2",
"file-loader": "^0.9.0",
"flow-bin": "^0.27.0",
"fs": "0.0.2",
Expand All @@ -128,6 +128,7 @@
"jss": "^3.11.1",
"jss-extend": "^1.2.1",
"mocha": "^2.5.3",
"ncp": "^2.0.0",
"node-sass": "^3.7.0",
"postcss-loader": "^0.9.1",
"proxy-middleware": "^0.15.0",
Expand All @@ -150,9 +151,9 @@
"todomvc-app-css": "^2.0.6",
"url-loader": "^0.5.7",
"webdriverio": "^4.0.9",
"webpack": "^1.13.1",
"webpack": "^2.1.0-beta.18",
"webpack-dev-middleware": "^1.6.1",
"webpack-dev-server": "1.14.1",
"webpack-dev-server": "2.1.0-beta.0",
"webpack-hot-middleware": "^2.10.0",
"webpack-merge": "0.14.0"
}
Expand Down
21 changes: 3 additions & 18 deletions plugins/react/package.json
Expand Up @@ -30,6 +30,7 @@
"dependencies": {
"axios": "^0.12.0",
"body-parser": "^1.15.1",
"carte-blanche": "^0.3.0",
"carte-blanche-utils": "^0.0.1",
"chokidar": "^1.5.1",
"cors": "^2.7.1",
Expand All @@ -47,30 +48,14 @@
"socket.io": "^1.4.6",
"socket.io-client": "^1.4.6",
"speakingurl": "^9.0.0",
"velocity-react": "^1.1.5"
},
"peerDependencies": {
"carte-blanche": "^0.3.0",
"webpack": ">=1 <3"
"velocity-react": "^1.1.5",
"webpack": ">=1 <3 || ^2.1.0-beta"
},
"scripts": {
"build": "npm run build:frontend && npm run build:backend",
"build:frontend": "NODE_ENV=production webpack --config webpack.prod.babel.js",
"build:backend": "BABEL_DISABLE_CACHE=1 BABEL_ENV=production babel --out-dir='dist' plugin.js resolver.js server/server.js server/run.js server/utils/getAbsoluteVariationPath.js",
"dev": "npm run build:frontend -- --watch",
"prepublish": "npm run build"
},
"devDependencies": {
"autoprefixer": "^6.3.6",
"babel-cli": "^6.9.0",
"chai": "^3.5.0",
"css-loader": "^0.23.1",
"enzyme": "^2.3.0",
"extract-text-webpack-plugin": "^1.0.1",
"postcss-loader": "^0.9.1",
"rimraf": "^2.5.2",
"sinon": "^1.17.4",
"supertest": "^1.2.0",
"webpack": "^1.13.1"
}
}
12 changes: 6 additions & 6 deletions plugins/source/package.json
Expand Up @@ -27,19 +27,19 @@
"widget",
"react-component"
],
"peerDependencies": {
"carte-blanche": "^0.1.0",
"webpack": ">=1 <3",
"react": "^15.0.1"
},
"scripts": {
"build": "BABEL_DISABLE_CACHE=1 BABEL_ENV=production babel --out-dir='dist' plugin.js component.js",
"dev": "npm run build -- --watch",
"prepublish": "npm run build"
},
"dependencies": {
"carte-blanche": "^0.3.0",
"webpack": ">=1 <3 || ^2.1.0-beta",
"react": "^15.0.1"
},
"devDependencies": {
"autoprefixer": "^6.3.6",
"babel-cli": "^6.9.0",
"webpack": "^1.13.1"
"webpack": "^2.1.0-beta.18"
}
}
14 changes: 3 additions & 11 deletions webpack-plugin/package.json
Expand Up @@ -24,19 +24,11 @@
"carte-blanche-react-plugin": "^0.3.0",
"chai": "^3.5.0",
"exenv": "^1.2.1",
"extra-entry-webpack-plugin": "0.0.2",
"extra-entry-webpack-plugin": "0.0.3",
"loader-utils": "^0.2.15",
"lodash": "^4.13.1",
"mocha": "^2.5.3",
"read-multiple-files": "^1.1.1"
},
"devDependencies": {
"babel-cli": "^6.9.0",
"ncp": "^2.0.0",
"rimraf": "^2.5.2",
"sinon": "^1.17.4"
},
"peerDependencies": {
"webpack": ">=1 <3"
"read-multiple-files": "^1.1.1",
"webpack": ">=1 <3 || ^2.1.0-beta"
}
}

0 comments on commit fdcb99d

Please sign in to comment.