Commit c750d5a4 authored by Tasso Evangelista's avatar Tasso Evangelista Committed by Guilherme Gazzo
Browse files

chore: Development mode (#127)

parent 38c47b93
if (process.env.NODE_ENV === 'production') {
module.exports = require('./dist/fuselage.production.js');
} else {
module.exports = require('./dist/fuselage.development.js');
}
......@@ -13,13 +13,16 @@
"bugs": {
"url": "https://github.com/RocketChat/Rocket.Chat.Fuselage/issues"
},
"main": "dist/fuselage.js",
"main": "index.js",
"files": [
"index.js",
"dist"
],
"scripts": {
"start": "webpack --watch --mode development",
"build": "webpack --mode production",
"build:prod": "webpack --mode production",
"build:dev": "webpack --mode development",
"build": "run-p build:prod build:dev",
"eslint": "eslint src",
"stylelint": "stylelint 'src/**/*.scss'",
"lint": "run-s eslint stylelint",
......
......@@ -4,18 +4,18 @@ const path = require('path');
const { BundleAnalyzerPlugin } = require('webpack-bundle-analyzer');
module.exports = (env, argv) => ({
module.exports = (env, { mode = 'production' }) => ({
entry: {
fuselage: path.resolve(__dirname, 'src/index.js'),
},
output: {
filename: '[name].js',
filename: `[name].${ mode }.js`,
path: path.resolve(__dirname, 'dist'),
library: 'RocketChatFuselage',
libraryTarget: 'umd',
umdNamedDefine: true,
},
devtool: argv.mode === 'production' ? 'source-map' : 'eval-source-map',
devtool: mode === 'production' ? false : 'eval-source-map',
module: {
rules: [
{
......@@ -27,7 +27,7 @@ module.exports = (env, argv) => ({
presets: [
['@babel/preset-react', {
useBuiltIns: true,
development: argv.mode !== 'production',
development: mode !== 'production',
}],
],
plugins: ['@babel/plugin-transform-runtime'],
......@@ -52,8 +52,8 @@ module.exports = (env, argv) => ({
require('postcss-custom-properties')(),
require('postcss-logical')({ preserve: true }),
require('autoprefixer')(),
require('cssnano'),
],
mode === 'production' && require('cssnano'),
].filter(Boolean),
},
},
'sass-loader',
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment