Last active
May 29, 2018 08:16
-
-
Save Slavenin/8376458fe2e30ecc739fddf4a13b3be9 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
const path = require('path'); | |
const MiniCssExtractPlugin = require("mini-css-extract-plugin"); | |
module.exports = function(env) { | |
const production = process.env.NODE_ENV === 'production'; | |
return { | |
devtool: production ? 'source-maps' : 'eval', | |
entry: [ | |
'./js/app.js', | |
'./css/app.css', | |
'./css/phoenix.css', | |
], | |
optimization: { | |
splitChunks: { | |
cacheGroups: { | |
styles: { | |
name: 'styles', | |
test: /\.css$/, | |
chunks: 'all', | |
enforce: true | |
} | |
} | |
} | |
}, | |
output: production | |
? { | |
path: path.resolve(__dirname, '../priv/static/js'), | |
filename: 'app.js', | |
publicPath: '/', | |
} | |
: { | |
path: path.resolve(__dirname, 'public'), | |
filename: 'app.js', | |
publicPath: 'http://php-sandbox.ru:8080/', | |
}, | |
module: { | |
rules: [ | |
{ | |
test: /\.js$/, | |
exclude: /node_modules/, | |
use: { | |
loader: 'babel-loader', | |
}, | |
}, | |
{ | |
test: /\.s?[ac]ss$/, | |
use: [ | |
MiniCssExtractPlugin.loader, | |
'css-loader', | |
'sass-loader', | |
], | |
}, | |
{ | |
test: /\.(ttf|eot|woff|woff2|svg)$/, | |
use: { | |
loader: "file-loader", | |
options: { | |
name: "fonts/[name].[ext]", | |
}, | |
}, | |
}, | |
], | |
}, | |
devServer: { | |
headers: { | |
'Access-Control-Allow-Origin': '*', | |
}, | |
host: "10.0.0.6", | |
disableHostCheck: true, | |
port: 8080, | |
hot: true | |
}, | |
plugins: [ | |
new MiniCssExtractPlugin({ | |
filename: '[name].css' | |
}) | |
] | |
}; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment