Skip to content

Commit

Permalink
update webpack - add resolvers, format code
Browse files Browse the repository at this point in the history
 update lib apollo-link-error
 fix scss imports
  • Loading branch information
Maros Zeleny committed Aug 31, 2018
1 parent 7bf54d9 commit 373a6e7
Show file tree
Hide file tree
Showing 8 changed files with 59 additions and 70 deletions.
1 change: 0 additions & 1 deletion .env
Original file line number Diff line number Diff line change
@@ -1 +0,0 @@
NODE_PATH=src/
31 changes: 20 additions & 11 deletions config/webpack.config.dev.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
const autoprefixer = require("autoprefixer");
const path = require("path");
const webpack = require("webpack");
const BundleAnalyzerPlugin = require("webpack-bundle-analyzer").BundleAnalyzerPlugin;
const BundleAnalyzerPlugin = require("webpack-bundle-analyzer")
.BundleAnalyzerPlugin;
const HtmlWebpackPlugin = require("html-webpack-plugin");
const MiniCssExtractPlugin = require("mini-css-extract-plugin");
const CaseSensitivePathsPlugin = require("case-sensitive-paths-webpack-plugin");
Expand Down Expand Up @@ -31,19 +32,28 @@ module.exports = {
filename: "static/js/bundle.js",
chunkFilename: "static/js/[name].chunk.js",
publicPath: publicPath,
devtoolModuleFilenameTemplate: info => path.resolve(info.absoluteResourcePath).replace(/\\/g, "/")
devtoolModuleFilenameTemplate: info =>
path.resolve(info.absoluteResourcePath).replace(/\\/g, "/")
},
resolve: {
modules: ["node_modules", paths.appNodeModules].concat(
process.env.NODE_PATH.split(path.delimiter).filter(Boolean)
),
extensions: [".web.js", ".mjs", ".js", ".json", ".web.jsx", ".jsx"],
extensions: [
".web.js",
".mjs",
".js",
".json",
".web.jsx",
".jsx",
".scss"
],
alias: {
"react-native": "react-native-web"
"react-native": "react-native-web",
components: path.resolve("src/components"),
containers: path.resolve("src/containers")
},
plugins: [
new ModuleScopePlugin(paths.appSrc, [paths.appPackageJson])
]
plugins: [new ModuleScopePlugin(paths.appSrc, [paths.appPackageJson])]
},
module: {
strictExportPresence: true,
Expand All @@ -52,7 +62,7 @@ module.exports = {
{
test: /\.mjs$/,
include: /node_modules/,
type: "javascript/auto",
type: "javascript/auto"
},
{
test: /\.(js|jsx|mjs)$/,
Expand Down Expand Up @@ -109,7 +119,7 @@ module.exports = {
{
loader: "css-loader",
options: {
importLoaders:1,
importLoaders: 1,
sourceMap: true,
modules: true,
localIdentName: "[path][name]__[local]--[hash:base64:5]"
Expand Down Expand Up @@ -149,8 +159,7 @@ module.exports = {
new CaseSensitivePathsPlugin(),
new WatchMissingNodeModulesPlugin(paths.appNodeModules),
new BundleAnalyzerPlugin(),
new webpack.IgnorePlugin(/^\.\/locale$/, /moment$/),

new webpack.IgnorePlugin(/^\.\/locale$/, /moment$/)
],
node: {
dgram: "empty",
Expand Down
5 changes: 3 additions & 2 deletions config/webpack.config.prod.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,8 @@ module.exports = {
),
extensions: [".web.js", ".mjs", ".js", ".json", ".web.jsx", ".jsx"],
alias: {
"react-native": "react-native-web"
"react-native": "react-native-web",
components: path.resolve("/src/components")
},
plugins: [new ModuleScopePlugin(paths.appSrc, [paths.appPackageJson])]
},
Expand All @@ -73,7 +74,7 @@ module.exports = {
{
test: /\.mjs$/,
include: /node_modules/,
type: "javascript/auto",
type: "javascript/auto"
},
{
test: /\.(js|jsx|mjs)$/,
Expand Down
Loading

0 comments on commit 373a6e7

Please sign in to comment.