diff options
| author | bozokopic <bozo.kopic@gmail.com> | 2018-04-09 09:25:32 +0200 |
|---|---|---|
| committer | bozokopic <bozo.kopic@gmail.com> | 2018-04-09 09:25:32 +0200 |
| commit | 234d2def50f630e54d4d184dcb3f3df63437f49e (patch) | |
| tree | 23260ac1b12b89f5efb8819f0eb57628f5d21010 /webpack.config.js | |
| parent | 1a7bbad8a6295db02d3e66a8d601b5e9da1e9057 (diff) | |
build refactoring
Diffstat (limited to 'webpack.config.js')
| -rw-r--r-- | webpack.config.js | 83 |
1 files changed, 14 insertions, 69 deletions
diff --git a/webpack.config.js b/webpack.config.js index 46ee0a3..08daa57 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -1,13 +1,8 @@ -var path = require('path'); -var fs = require('fs'); -var webpack = require('webpack'); +const path = require('path'); +const fs = require('fs'); +const webpack = require('webpack'); +const CopyWebpackPlugin = require('copy-webpack-plugin'); -// moment locales hack -var momentLocalePath = path.join( - __dirname, 'node_modules', 'moment', 'src', 'lib', 'locale', 'locale'); -if (!fs.existsSync(momentLocalePath)) { - fs.mkdirSync(momentLocalePath); -} module.exports = { entry: { @@ -21,76 +16,26 @@ module.exports = { module: { rules: [ { - test: /\.js$/, - exclude: [/node_modules(?!(\/moment\/src)|(\\moment\\src))/], - loader: 'babel-loader', - options: { - presets: [['es2015', {modules: false}]], - plugins: [] - // plugins: ["transform-runtime", - // "transform-decorators", - // ["transform-async-to-module-method", - // {module: "bluebird", - // method: "coroutine"}]], - // retainLines: true - } - }, - { test: /\.scss$/, - use: ["style-loader", "css-loader", "resolve-url-loader", "sass-loader?sourceMap"] + use: ["style-loader", "css-loader?minimize=true", "resolve-url-loader", "sass-loader?sourceMap"] }, { - test: /(\/|\\)buffer(\/|\\)index\.js$/, - use: 'imports-loader?global=>window' - }, - - - - { test: /\.woff(\?v=\d+\.\d+\.\d+)?$/, use: "url-loader?name=fonts/[hash].[ext]&limit=10000&mimetype=application/font-woff" }, - { test: /\.woff2(\?v=\d+\.\d+\.\d+)?$/, use: "url-loader?name=fonts/[hash].[ext]&limit=10000&mimetype=application/font-woff" }, - { test: /\.ttf(\?v=\d+\.\d+\.\d+)?$/, use: "url-loader?name=fonts/[hash].[ext]&limit=10000&mimetype=application/octet-stream" }, - { test: /\.eot(\?v=\d+\.\d+\.\d+)?$/, use: "file-loader?name=fonts/[hash].[ext]" }, - { test: /\.svg(\?v=\d+\.\d+\.\d+)?$/, use: "url-loader?name=fonts/[hash].[ext]&limit=10000&mimetype=image/svg+xml" } - + test: /\.ttf$/, + use: "file-loader?name=fonts/[hash].[ext]" + } ] }, resolve: { modules: [ path.join(__dirname, 'src_js'), path.join(__dirname, 'src_web'), - path.join(__dirname, 'node_modules')], - alias: { - 'ByteBuffer': 'bytebuffer', - 'Long': 'long', - 'underscore': 'underscore/underscore', - 'moment': 'moment/src/moment' - } - }, - resolveLoader: { - alias: { - static: 'file-loader?context=src_web/static&name=[path][name].[ext]', - template: 'raw' - } + path.join(__dirname, 'node_modules')] }, - externals: [{ - 'fs': 'commonjs fs', - 'app': 'commonjs app', - 'browser-window': 'commonjs browser-window', - 'electron': 'commonjs electron', - 'child_process': 'commonjs child_process' - }], - node: { - console: false, - global: false, - process: false, - Buffer: false, - __filename: false, - __dirname: false, - setImmediate: false + watchOptions: { + ignored: /node_modules/ }, - //devtool: 'inline-source-map', - devtool: 'source-map', plugins: [ - //new webpack.optimize.UglifyJsPlugin({compress: {warnings: false}}) - ] + new CopyWebpackPlugin([{from: 'src_web/static'}]) + ], + devtool: 'source-map' }; |
