Skip to content

Instantly share code, notes, and snippets.

@godmar
Created December 1, 2016 19:27
Show Gist options
  • Save godmar/fb5057897eca1b3d8b262bedb2a63037 to your computer and use it in GitHub Desktop.
Save godmar/fb5057897eca1b3d8b262bedb2a63037 to your computer and use it in GitHub Desktop.
incomplete webpack2 patch
diff --git a/config/webpack.config.prod.js b/config/webpack.config.prod.js
index df6db14..6970253 100644
--- a/config/webpack.config.prod.js
+++ b/config/webpack.config.prod.js
@@ -43,6 +43,8 @@ if (env['process.env'].NODE_ENV !== '"production"') {
throw new Error('Production builds must have NODE_ENV=production.');
}
+console.log(`resolve path: ${paths.nodePaths}`)
+
// This is the production configuration.
// It compiles slowly and is focused on producing a fast and minimal bundle.
// The development configuration is different and lives in a separate file.
@@ -74,12 +76,12 @@ module.exports = {
// We use `fallback` instead of `root` because we want `node_modules` to "win"
// if there any conflicts. This matches Node resolution mechanism.
// https://github.com/facebookincubator/create-react-app/issues/253
- fallback: paths.nodePaths,
+ modules: [ 'node_modules', ...paths.nodePaths ],
// These are the reasonable defaults supported by the Node ecosystem.
// We also include JSX as a common component filename extension to support
// some tools, although we do not recommend using it, see:
// https://github.com/facebookincubator/create-react-app/issues/290
- extensions: ['.js', '.json', '.jsx', ''],
+ extensions: ['.js', '.json', '.jsx'],
alias: {
// Support React Native Web
// https://www.smashingmagazine.com/2016/08/a-glimpse-into-the-future-with-react-native-for-web/
@@ -90,12 +92,17 @@ module.exports = {
module: {
// First, run the linter.
// It's important to do this before Babel processes the JS.
- preLoaders: [
+ // https://gist.github.com/sokra/27b24881210b56bbaff7#gistcomment-1880757
+ rules: [
+/* fails with:
+Module '/home/gback/fee2/node_modules/eslint/lib/api.js' is not a loader (must have normal or pitch function)
{
+ enforce: 'pre',
test: /\.(js|jsx)$/,
loader: 'eslint',
include: paths.appSrc
}
+*/
],
loaders: [
// Default loader: load all assets that are not handled
@@ -144,7 +151,7 @@ module.exports = {
// in the main CSS file.
{
test: /\.css$/,
- loader: ExtractTextPlugin.extract('style', 'css?importLoaders=1!postcss')
+ loader: ExtractTextPlugin.extract({ fallbackLoader: 'style', loader: 'css?importLoaders=1!postcss' })
// Note: this won't work without `new ExtractTextPlugin()` in `plugins`.
},
// JSON is not enabled by default in Webpack but both Node and Browserify
@@ -156,6 +163,7 @@ module.exports = {
]
},
+/*
// We use PostCSS for autoprefixing only.
postcss: function() {
return [
@@ -169,6 +177,7 @@ module.exports = {
}),
];
},
+*/
plugins: [
// Makes the public URL available as %PUBLIC_URL% in index.html, e.g.:
// <link rel="shortcut icon" href="%PUBLIC_URL%/favicon.ico">
diff --git a/package.json b/package.json
index f542e9d..e5e8fc0 100644
--- a/package.json
+++ b/package.json
@@ -23,7 +23,7 @@
"eslint-plugin-import": "2.0.1",
"eslint-plugin-jsx-a11y": "2.2.3",
"eslint-plugin-react": "6.4.1",
- "extract-text-webpack-plugin": "1.0.1",
+ "extract-text-webpack-plugin": "^2.0.0-beta.4",
"file-loader": "0.9.0",
"filesize": "3.3.0",
"fs-extra": "0.30.0",
@@ -48,7 +48,8 @@
},
"dependencies": {
"react": "^15.4.0",
- "react-dom": "^15.4.0"
+ "react-dom": "^15.4.0",
+ "whatwg-fetch": "^1.0.0"
},
"scripts": {
"start": "node scripts/start.js",
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment