Created
March 11, 2017 20:23
-
-
Save jeff-kilbride/e58a6831546efeb43fef8fae6b2d1da6 to your computer and use it in GitHub Desktop.
css-loader error webpack.config.js
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
'use strict'; | |
const webpack = require('webpack'), | |
path = require('path'), | |
ETPlugin = require('extract-text-webpack-plugin'); | |
// Entry and build paths. | |
const PUBLIC_DIR = path.resolve(__dirname, 'public'), | |
BUILD_DIR = path.resolve(PUBLIC_DIR, 'js'), | |
APP_DIR = path.resolve(__dirname, 'client'), | |
ENTRY = path.resolve(APP_DIR, 'pack.js'); | |
// Export the config. | |
module.exports = { | |
entry: { | |
app: ENTRY | |
}, | |
output: { | |
path: BUILD_DIR, | |
filename: '[name].js' | |
}, | |
node: { | |
fs: 'empty' | |
}, | |
module: { | |
rules: [ | |
{ | |
test: /\.css$/, | |
use: ETPlugin.extract({ | |
fallback: 'style-loader', | |
use: 'css-loader' | |
}) | |
}, | |
{ | |
test: /\.scss$/, | |
use: ETPlugin.extract({ | |
fallback: 'style-loader', | |
use: [ | |
'css-loader', | |
'sass-loader' | |
] | |
}) | |
}, | |
{ | |
test: /\.(png|jpe?g|gif|ico)$/, | |
loader: 'file-loader', | |
options: { | |
name: '../css/assets/[name].[hash].[ext]' | |
} | |
}, | |
{ | |
test: /\.(woff|woff2|eot|ttf|svg)(\?v=\d+\.\d+\.\d+)?$/, | |
loader: 'url-loader', | |
options: { | |
limit: 1024, | |
name: '../css/assets/[name].[hash].[ext]' | |
} | |
}, | |
], | |
}, | |
plugins: [ | |
new ETPlugin({ | |
filename: '../css/styles.css' | |
}), | |
new webpack.ContextReplacementPlugin(/moment[\\\/]locale$/, /^\.\/(en)$/) | |
], | |
resolve: { | |
extensions: ['js', 'jsx', 'css', 'scss', 'sass'] | |
}, | |
externals: { | |
'jquery': 'jQuery' | |
}, | |
devtool: 'eval', | |
devServer: { | |
historyApiFallback: true | |
} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment