Commit cc7e581b authored by Sascha Herzinger's avatar Sascha Herzinger
Browse files

webpack 4 & docker

parent 91064fed
Pipeline #3892 failed with stages
in 6 minutes and 26 seconds
node_modules
lib
.git
\ No newline at end of file
{
"libs": [
"browser",
"ecmascript"
],
"plugins": {
"node": {},
"webpack": {},
"es_modules": {},
"modules": {}
}
}
FROM node:9.7.1
ADD . /
RUN npm install
This diff is collapsed.
......@@ -13,9 +13,9 @@
"url": "https://git-r3lab.uni.lu/Fractalis/fractal.js.git"
},
"scripts": {
"build": "./node_modules/webpack/bin/webpack.js --config webpack.config.js --env production",
"test": "./node_modules/karma/bin/karma start karma.config.js",
"devserver": "./node_modules/webpack-dev-server/bin/webpack-dev-server.js --config webpack.config.js"
"build": "./node_modules/webpack/bin/webpack.js --config webpack.config.js --mode production",
"devserver": "./node_modules/webpack-dev-server/bin/webpack-dev-server.js --config webpack.config.js --mode development",
"test": "./node_modules/karma/bin/karma start karma.config.js"
},
"main": "src/main.js",
"dependencies": {
......@@ -42,7 +42,7 @@
"@babel/plugin-proposal-object-rest-spread": "7.0.0-beta.40",
"@babel/plugin-transform-runtime": "7.0.0-beta.40",
"@babel/preset-env": "7.0.0-beta.40",
"babel-loader": "8.0.0-beta.0",
"babel-loader": "8.0.0-beta.2",
"css-loader": "0.28.9",
"file-loader": "1.1.6",
"sass-loader": "6.0.6",
......@@ -66,11 +66,10 @@
"karma-jasmine": "1.1.1",
"karma-sourcemap-loader": "0.3.7",
"karma-webpack": "2.0.9",
"webpack": "3.11.0",
"webpack-dev-server": "2.11.1",
"uglifyjs-webpack-plugin": "1.1.8",
"webpack": "4.1.1",
"webpack-dev-server": "3.1.0",
"webpack-cli": "2.0.10",
"yargs": "11.0.0",
"node-sass": "4.7.2",
"uglify-js": "git+https://github.com/mishoo/UglifyJS2.git#harmony"
"node-sass": "4.7.2"
}
}
const webpack = require('webpack')
const UglifyJsPlugin = require('uglifyjs-webpack-plugin')
const path = require('path')
const env = require('yargs').argv.env
const mode = require('yargs').argv.mode
const VERSION = require('./package.json').version
let plugins = [
new webpack.HotModuleReplacementPlugin(),
new webpack.NamedModulesPlugin()
new webpack.HotModuleReplacementPlugin()
]
let filename = ''
const library = 'fractal'
if (env === 'production') {
plugins.push(new UglifyJsPlugin())
plugins.push(new webpack.optimize.ModuleConcatenationPlugin())
plugins.push(new webpack.DefinePlugin({'process.env': {NODE_ENV: '"production"'}}))
if (mode === 'production') {
filename = `${library}-${VERSION}.min.js`
} else {
filename = `${library}.js`
......
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