Merge pull request #1192 from dmitrylyzo/use-root-config

Use root build config
This commit is contained in:
dkanada 2020-05-07 02:32:22 +09:00 committed by GitHub
commit b0b3f77525
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 34 additions and 8 deletions

View File

@ -1,3 +0,0 @@
{
"presets": ["@babel/preset-env"]
}

View File

@ -1,10 +1,11 @@
const packageConfig = require('./package.json');
const postcssPresetEnv = require('postcss-preset-env');
const autoprefixer = require('autoprefixer');
const cssnano = require('cssnano');
const config = () => ({
plugins: [
postcssPresetEnv(),
postcssPresetEnv({browsers: packageConfig.browserslist}),
autoprefixer(),
cssnano()
]

View File

@ -1,6 +1,8 @@
const path = require('path');
const common = require('./webpack.common');
const merge = require('webpack-merge');
const packageConfig = require('./package.json');
const postcssConfig = require('./postcss.config.js');
module.exports = merge(common, {
mode: 'development',
@ -15,11 +17,23 @@ module.exports = merge(common, {
{
test: /\.js$/,
exclude: /node_modules[\\/](?!query-string|split-on-first|strict-uri-encode)/,
loader: 'babel-loader'
use: {
loader: 'babel-loader',
options: {
presets: packageConfig.babel.presets
}
}
},
{
test: /\.css$/i,
use: ['style-loader', 'css-loader', 'postcss-loader']
use: [
'style-loader',
'css-loader',
{
loader: 'postcss-loader',
options: postcssConfig()
}
]
},
{
test: /\.(png|jpg|gif)$/i,

View File

@ -1,5 +1,7 @@
const common = require('./webpack.common');
const merge = require('webpack-merge');
const packageConfig = require('./package.json');
const postcssConfig = require('./postcss.config.js');
module.exports = merge(common, {
mode: 'production',
@ -8,11 +10,23 @@ module.exports = merge(common, {
{
test: /\.js$/,
exclude: /node_modules[\\/](?!query-string|split-on-first|strict-uri-encode)/,
loader: 'babel-loader'
use: {
loader: 'babel-loader',
options: {
presets: packageConfig.babel.presets
}
}
},
{
test: /\.css$/i,
use: ['style-loader', 'css-loader', 'postcss-loader']
use: [
'style-loader',
'css-loader',
{
loader: 'postcss-loader',
options: postcssConfig()
}
]
},
{
test: /\.(png|jpg|gif)$/i,