Skip to content

Commit

Permalink
fix: fix webpack config
Browse files Browse the repository at this point in the history
  • Loading branch information
vios-fish committed Feb 2, 2021
1 parent 2607e26 commit 03d31e8
Show file tree
Hide file tree
Showing 3 changed files with 82 additions and 78 deletions.
14 changes: 7 additions & 7 deletions front/webpack.common.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const path = require('path')
const JSX_PATH = __dirname + '/app';
const path = require('path');
const JSX_PATH = path.resolve(__dirname, '/app');

module.exports = {
entry: {
Expand All @@ -16,17 +16,17 @@ module.exports = {
test: /\.jsx?$/,
exclude: /node_modules/,
loader: 'babel-loader',
query: {
options: {
presets: ['react', 'stage-1']
}
},
}
]
},
resolve: {
modules: ['node_modules'],
extensions: ['.js', '.jsx'],
alias: {
"automan": JSX_PATH,
},
automan: JSX_PATH
}
}
}
};
72 changes: 37 additions & 35 deletions front/webpack.dev.js
Original file line number Diff line number Diff line change
@@ -1,37 +1,39 @@
const webpack = require('webpack')
const merge = require('webpack-merge')
const common = require('./webpack.common.js')
const path = require('path')
const BundleTracker = require('webpack-bundle-tracker')
const CopyWebpackPlugin = require('copy-webpack-plugin')
const webpack = require('webpack');
const merge = require('webpack-merge');
const common = require('./webpack.common.js');
const path = require('path');
const BundleTracker = require('webpack-bundle-tracker');
const CopyWebpackPlugin = require('copy-webpack-plugin');

module.exports = merge(common, {
devtool: 'inline-source-map',
plugins: [
new webpack.HotModuleReplacementPlugin(),
new BundleTracker({filename: 'webpack-stats.json'}),
new webpack.ProvidePlugin({
$: 'jquery',
jQuery: 'jquery',
'window.jQuery': 'jquery'
}),
new CopyWebpackPlugin([
{
from: path.resolve(__dirname, 'static/img/'),
to: path.resolve(__dirname, 'dist/img/')
},
{
from: path.resolve(__dirname, 'static/css/'),
to: path.resolve(__dirname, 'dist/css/')
},
{
from: path.resolve(__dirname, 'static/js/'),
to: path.resolve(__dirname, 'dist/js/')
},
{
from: path.resolve(__dirname, 'static/fonts/'),
to: path.resolve(__dirname, 'dist/fonts/')
},
])
]
})
devtool: 'inline-source-map',
plugins: [
new webpack.HotModuleReplacementPlugin(),
new BundleTracker({ filename: 'webpack-stats.json' }),
new webpack.ProvidePlugin({
$: 'jquery',
jQuery: 'jquery',
'window.jQuery': 'jquery'
}),
new CopyWebpackPlugin({
patterns: [
{
from: path.resolve(__dirname, 'static/img/'),
to: path.resolve(__dirname, 'dist/img/')
},
{
from: path.resolve(__dirname, 'static/css/'),
to: path.resolve(__dirname, 'dist/css/')
},
{
from: path.resolve(__dirname, 'static/js/'),
to: path.resolve(__dirname, 'dist/js/')
},
{
from: path.resolve(__dirname, 'static/fonts/'),
to: path.resolve(__dirname, 'dist/fonts/')
}
]
})
]
});
74 changes: 38 additions & 36 deletions front/webpack.prod.js
Original file line number Diff line number Diff line change
@@ -1,38 +1,40 @@
const webpack = require('webpack')
const merge = require('webpack-merge')
const common = require('./webpack.common.js')
const path = require('path')
const BundleTracker = require('webpack-bundle-tracker')
const UglifyEsPlugin = require('uglify-es-webpack-plugin')
const CopyWebpackPlugin = require('copy-webpack-plugin')
const webpack = require('webpack');
const merge = require('webpack-merge');
const common = require('./webpack.common.js');
const path = require('path');
const BundleTracker = require('webpack-bundle-tracker');
const UglifyEsPlugin = require('uglify-es-webpack-plugin');
const CopyWebpackPlugin = require('copy-webpack-plugin');

module.exports = merge(common, {
plugins: [
new webpack.HotModuleReplacementPlugin(),
new BundleTracker({filename: 'webpack-stats.json'}),
new UglifyEsPlugin(),
new webpack.ProvidePlugin({
$: 'jquery',
jQuery: 'jquery',
'window.jQuery': 'jquery'
}),
new CopyWebpackPlugin([
{
from: path.resolve(__dirname, 'static/img/'),
to: path.resolve(__dirname, 'dist/img/')
},
{
from: path.resolve(__dirname, 'static/css/'),
to: path.resolve(__dirname, 'dist/css/')
},
{
from: path.resolve(__dirname, 'static/js/'),
to: path.resolve(__dirname, 'dist/js/')
},
{
from: path.resolve(__dirname, 'static/fonts/'),
to: path.resolve(__dirname, 'dist/fonts/')
},
])
],
})
plugins: [
new webpack.HotModuleReplacementPlugin(),
new BundleTracker({ filename: 'webpack-stats.json' }),
new UglifyEsPlugin(),
new webpack.ProvidePlugin({
$: 'jquery',
jQuery: 'jquery',
'window.jQuery': 'jquery'
}),
new CopyWebpackPlugin({
patterns: [
{
from: path.resolve(__dirname, 'static/img/'),
to: path.resolve(__dirname, 'dist/img/')
},
{
from: path.resolve(__dirname, 'static/css/'),
to: path.resolve(__dirname, 'dist/css/')
},
{
from: path.resolve(__dirname, 'static/js/'),
to: path.resolve(__dirname, 'dist/js/')
},
{
from: path.resolve(__dirname, 'static/fonts/'),
to: path.resolve(__dirname, 'dist/fonts/')
}
]
})
]
});

0 comments on commit 03d31e8

Please sign in to comment.