Browse Source

Merge branch 'webpackV4' into dev

docs
Artur Arseniev 8 years ago
parent
commit
784cc58cdc
  1. 52041
      dist/grapes.js
  2. 7
      dist/grapes.min.js
  3. 5341
      package-lock.json
  4. 5
      package.json
  5. 21
      webpack.config.js

52041
dist/grapes.js

File diff suppressed because one or more lines are too long

7
dist/grapes.min.js

File diff suppressed because one or more lines are too long

5341
package-lock.json

File diff suppressed because it is too large

5
package.json

@ -37,8 +37,9 @@
"prettier": "^1.13.0", "prettier": "^1.13.0",
"sinon": "^5.0.10", "sinon": "^5.0.10",
"string-replace-loader": "^2.1.1", "string-replace-loader": "^2.1.1",
"webpack": "^3.10.0", "webpack": "^4.14.0",
"webpack-dev-server": "^2.11.1", "webpack-cli": "^3.0.8",
"webpack-dev-server": "^3.1.4",
"whatwg-fetch": "^2.0.4" "whatwg-fetch": "^2.0.4"
}, },
"keywords": [ "keywords": [

21
webpack.config.js

@ -1,25 +1,27 @@
const HtmlWebpackPlugin = require('html-webpack-plugin'); const HtmlWebpackPlugin = require('html-webpack-plugin');
const pkg = require('./package.json'); const pkg = require('./package.json');
const webpack = require('webpack'); const webpack = require('webpack');
const path = require('path');
const fs = require('fs'); const fs = require('fs');
let plugins = []; let plugins = [];
module.exports = env => { module.exports = env => {
const name = pkg.name;
const isProd = env === 'prod';
const output = { const output = {
filename: './dist/grapes.min.js', path: path.join(__dirname, 'dist'),
library: 'grapesjs', filename: 'grapes.min.js',
library: name,
libraryTarget: 'umd', libraryTarget: 'umd',
}; };
if (env == 'prod') { if (isProd) {
plugins = [ plugins = [
new webpack.optimize.ModuleConcatenationPlugin(), new webpack.optimize.ModuleConcatenationPlugin(),
new webpack.optimize.UglifyJsPlugin({ minimize:true, compressor: {warnings:false}}), new webpack.BannerPlugin(`${name} - ${pkg.version}`),
new webpack.BannerPlugin(`${pkg.name} - ${pkg.version}`),
]; ];
} else if (env == 'dev') { } else if (env === 'dev') {
output.filename = './dist/grapes.js'; output.filename = 'grapes.js';
} else { } else {
const index = 'index.html'; const index = 'index.html';
const indexDev = `_${index}`; const indexDev = `_${index}`;
@ -36,8 +38,9 @@ module.exports = env => {
entry: './src', entry: './src',
output: output, output: output,
plugins: plugins, plugins: plugins,
mode: isProd ? 'production' : 'development',
module: { module: {
loaders: [{ rules: [{
test: /\/index\.js$/, test: /\/index\.js$/,
loader: 'string-replace-loader', loader: 'string-replace-loader',
query: { query: {

Loading…
Cancel
Save