Created
April 22, 2018 15:42
-
-
Save jacky810124/d20d42f849518a4920e91e70d9dfdc97 to your computer and use it in GitHub Desktop.
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
import styles from './styles.scss' | |
class SomeComponent extends React.Component { | |
render () { | |
return ( | |
<div className={styles['some-component']}> | |
SomeComponent | |
</div> | |
) | |
} | |
} | |
export default SomeComponent |
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
const path = require('path') | |
const webpack = require('webpack') | |
const ExtractTextPlugin = require('extract-text-webpack-plugin') | |
const config = require('./config') | |
module.exports = { | |
entry: { | |
app: ['babel-polyfill', './src/app.js'], | |
}, | |
output: { | |
path: path.resolve('./build'), | |
filename: '[name]-[hash].js', | |
publicPath: '/' | |
}, | |
module: { | |
rules: [ | |
{ | |
test: /\.css?$/, | |
use: ExtractTextPlugin.extract({ | |
use: ['css-loader'] | |
}) | |
}, | |
{ | |
test: /\.scss$/, | |
exclude: [path.resolve('node_modules')], | |
use: ExtractTextPlugin.extract({ | |
fallback: 'style-loader', | |
use: [ | |
{ | |
loader: 'css-loader', | |
options: { | |
modules: true, | |
sourceMap: true, | |
localIdentName: '[local]-[hash:base64:5]' | |
} | |
}, | |
'postcss-loader', | |
'sass-loader' | |
] | |
}) | |
} | |
] | |
}, | |
plugins: [ | |
new ExtractTextPlugin({ | |
filename: process.env.NODE_ENV === 'development' | |
? 'bundle.css' | |
: 'bundle-[contenthash:base64:10].css', | |
disable: process.env.NODE_ENV === 'development', | |
allChunks: true | |
}) | |
], | |
resolve: { | |
extensions: ['.js', '.json', '.jsx', '.css', '.scss'] | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment