diff --git a/webpack.dev.config.js b/webpack.config.dev.js similarity index 96% rename from webpack.dev.config.js rename to webpack.config.dev.js index 525d668efb3f748f6adca99d13455ef443a6e16d..b800f2c789978ac6a9617d0bd1f70b18d20b64e7 100644 --- a/webpack.dev.config.js +++ b/webpack.config.dev.js @@ -50,5 +50,5 @@ module.exports = { stats: { colors: true, }, - devtool: 'source-map', + devtool: 'cheap-module-eval-source-map', }; diff --git a/webpack.config.prod.js b/webpack.config.prod.js new file mode 100644 index 0000000000000000000000000000000000000000..f87d43e1cb52169ac78bc8cb1e6bce1079477959 --- /dev/null +++ b/webpack.config.prod.js @@ -0,0 +1,59 @@ +const path = require('path'); +const ExtractTextPlugin = require('extract-text-webpack-plugin'); + +module.exports = { + mode: 'production', + entry: [ + './assets/scripts/src/sholo.js', + './assets/styles/scss/sholo.scss', + ], + output: { + path: path.join(__dirname, '/assets'), + publicPath: '/assets/', + filename: 'scripts/dist/sholo.min.js', + libraryTarget: 'umd', + library: 'Sholo', + }, + module: { + rules: [ + { + test: /\.js$/, + exclude: /node_modules/, + loader: 'eslint-loader', + enforce: 'pre', + options: { + failOnWarning: false, + failOnError: true, + }, + }, + { + test: /\.js$/, + exclude: /node_modules/, + loader: 'babel-loader', + options: { + presets: ['env'], + }, + }, + { + test: /.scss$/, + loader: ExtractTextPlugin.extract([ + { + loader: 'css-loader', + options: { minimize: true }, + }, + 'sass-loader', + ]), + }, + ], + }, + plugins: [ + new ExtractTextPlugin({ + filename: 'styles/css/sholo.min.css', + allChunks: true, + }), + ], + stats: { + colors: true, + }, + devtool: 'cheap-module-source-map', +};