Created
March 27, 2017 09:26
-
-
Save octatone/8d195b68325fcd5460706d21b6d677ca to your computer and use it in GitHub Desktop.
config/webpack.config.base.js
This file contains hidden or 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
var path = require('path') | |
var postCSSConfig = require('./postCSS.config') | |
const VIEWS_ONLY = process.env.VIEWS_ONLY | |
const include = path.resolve(__dirname, '../client') | |
const exclude = /node_modules/ | |
module.exports = { | |
devtool: 'inline-source-map', | |
output: { | |
path: path.join(__dirname, '..', 'dist'), | |
filename: 'bundle.js', | |
publicPath: '/dist/' | |
}, | |
resolve: { | |
extensions: ['.js', '.jsx', '.ts', '.tsx'], | |
modules: [ | |
path.resolve(__dirname, '../client'), | |
path.resolve(__dirname, '../node_modules') | |
] | |
}, | |
resolveLoader: { | |
extensions: ['.js', '.json'], | |
modules: [ | |
path.resolve(__dirname, '../node_modules'), | |
'node_modules' | |
] | |
}, | |
module: { | |
rules: [ | |
{ test: /\.js$/, enforce: 'pre', loader: 'source-map-loader', include, exclude}, | |
{ test: /\.jsx?$/, loader: 'babel-loader', include, exclude}, | |
{ | |
test: /\.css$/, | |
use: [ | |
'style-loader', | |
'css-loader', | |
{ | |
loader: 'postcss-loader', | |
options: { | |
plugins: postCSSConfig(VIEWS_ONLY ? 'design' : undefined) | |
} | |
} | |
] | |
}, | |
// { test: /\.tsx?$/, use: ['react-hot-loader', 'babel-loader', 'ts-loader'], exclude: /node_modules/ }, | |
{ test: /\.tsx?$/, use: ['babel-loader', 'ts-loader'], include, exclude }, | |
{ test: /\.(png|jpg)$/, loader: 'file-loader?name=assets/[name].[ext]', include, exclude }, | |
{ test: /\.json$/, loader: 'json-loader' }, | |
{ test: /\.svg$/, loader: 'svg-inline?removeSVGTagAttrs=false' } | |
] | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment