mirror of
https://github.com/chinchang/web-maker.git
synced 2025-08-04 04:17:33 +02:00
fix browserlist and add vendor.js chunk
This commit is contained in:
@@ -1,64 +1,68 @@
|
|||||||
{
|
{
|
||||||
"private": true,
|
"private": true,
|
||||||
"name": "webmaker",
|
"name": "webmaker",
|
||||||
"version": "0.0.0",
|
"version": "0.0.0",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"start": "if-env NODE_ENV=production && npm run -s serve || npm run -s dev",
|
"start": "if-env NODE_ENV=production && npm run -s serve || npm run -s dev",
|
||||||
"build": "preact build",
|
"build": "preact build",
|
||||||
"serve": "preact build && preact serve",
|
"serve": "preact build && preact serve",
|
||||||
"dev": "preact watch",
|
"dev": "preact watch",
|
||||||
"lint": "eslint src",
|
"lint": "eslint src",
|
||||||
"test": "jest ./tests"
|
"test": "jest ./tests"
|
||||||
},
|
},
|
||||||
"eslintConfig": {
|
"eslintConfig": {
|
||||||
"extends": "eslint-config-synacor"
|
"extends": "eslint-config-synacor"
|
||||||
},
|
},
|
||||||
"eslintIgnore": [
|
"eslintIgnore": [
|
||||||
"build/*"
|
"build/*"
|
||||||
],
|
],
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"eslint": "^4.9.0",
|
"eslint": "^4.9.0",
|
||||||
"eslint-config-synacor": "^2.0.2",
|
"eslint-config-synacor": "^2.0.2",
|
||||||
"identity-obj-proxy": "^3.0.0",
|
"identity-obj-proxy": "^3.0.0",
|
||||||
"if-env": "^1.0.0",
|
"if-env": "^1.0.0",
|
||||||
"jest": "^21.2.1",
|
"jest": "^21.2.1",
|
||||||
"preact-cli": "^2.1.0",
|
"preact-cli": "^2.1.0",
|
||||||
"preact-render-spy": "^1.2.1"
|
"preact-render-spy": "^1.2.1"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@emmetio/codemirror-plugin": "^0.5.4",
|
"@emmetio/codemirror-plugin": "^0.5.4",
|
||||||
"codemirror": "^5.37.0",
|
"codemirror": "^5.37.0",
|
||||||
"copy-webpack-plugin": "^4.5.1",
|
"copy-webpack-plugin": "^4.5.1",
|
||||||
"esprima": "^4.0.0",
|
"esprima": "^4.0.0",
|
||||||
"firebase": "^5.0.4",
|
"firebase": "^5.0.4",
|
||||||
"preact": "^8.2.6",
|
"preact": "^8.2.6",
|
||||||
"preact-compat": "^3.17.0",
|
"preact-compat": "^3.17.0",
|
||||||
"preact-router": "^2.5.7",
|
"preact-router": "^2.5.7",
|
||||||
"split.js": "^1.3.5"
|
"split.js": "^1.3.5"
|
||||||
},
|
},
|
||||||
"jest": {
|
"jest": {
|
||||||
"verbose": true,
|
"verbose": true,
|
||||||
"setupFiles": [
|
"setupFiles": [
|
||||||
"<rootDir>/src/tests/__mocks__/browserMocks.js"
|
"<rootDir>/src/tests/__mocks__/browserMocks.js"
|
||||||
],
|
],
|
||||||
"testURL": "http://localhost:8080",
|
"testURL": "http://localhost:8080",
|
||||||
"moduleFileExtensions": [
|
"moduleFileExtensions": [
|
||||||
"js",
|
"js",
|
||||||
"jsx"
|
"jsx"
|
||||||
],
|
],
|
||||||
"moduleDirectories": [
|
"moduleDirectories": [
|
||||||
"node_modules"
|
"node_modules"
|
||||||
],
|
],
|
||||||
"moduleNameMapper": {
|
"moduleNameMapper": {
|
||||||
"\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$": "<rootDir>/src/tests/__mocks__/fileMock.js",
|
"\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$": "<rootDir>/src/tests/__mocks__/fileMock.js",
|
||||||
"\\.(css|less|scss)$": "identity-obj-proxy",
|
"\\.(css|less|scss)$": "identity-obj-proxy",
|
||||||
"^./style$": "identity-obj-proxy",
|
"^./style$": "identity-obj-proxy",
|
||||||
"^preact$": "<rootDir>/node_modules/preact/dist/preact.min.js",
|
"^preact$": "<rootDir>/node_modules/preact/dist/preact.min.js",
|
||||||
"^react$": "preact-compat",
|
"^react$": "preact-compat",
|
||||||
"^react-dom$": "preact-compat",
|
"^react-dom$": "preact-compat",
|
||||||
"^create-react-class$": "preact-compat/lib/create-react-class",
|
"^create-react-class$": "preact-compat/lib/create-react-class",
|
||||||
"^react-addons-css-transition-group$": "preact-css-transition-group"
|
"^react-addons-css-transition-group$": "preact-css-transition-group"
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
|
"browserslist": [
|
||||||
|
"last 3 Chrome versions",
|
||||||
|
"last 3 Firefox versions"
|
||||||
|
]
|
||||||
}
|
}
|
||||||
|
@@ -1,4 +1,5 @@
|
|||||||
import CopyWebpackPlugin from 'copy-webpack-plugin'
|
import CopyWebpackPlugin from 'copy-webpack-plugin'
|
||||||
|
var CommonsChunkPlugin = require('webpack/lib/optimize/CommonsChunkPlugin');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function that mutates original webpack config.
|
* Function that mutates original webpack config.
|
||||||
@@ -12,6 +13,15 @@ export default function (config, env, helpers) {
|
|||||||
if (env.isProd) {
|
if (env.isProd) {
|
||||||
config.devtool = false; // disable sourcemaps
|
config.devtool = false; // disable sourcemaps
|
||||||
|
|
||||||
|
config.plugins.push(
|
||||||
|
new CommonsChunkPlugin({
|
||||||
|
name: 'vendor',
|
||||||
|
minChunks: ({
|
||||||
|
resource
|
||||||
|
}) => /node_modules/.test(resource),
|
||||||
|
})
|
||||||
|
);
|
||||||
|
|
||||||
config.plugins.push(new CopyWebpackPlugin([{
|
config.plugins.push(new CopyWebpackPlugin([{
|
||||||
context: `${__dirname}/src/assets`,
|
context: `${__dirname}/src/assets`,
|
||||||
from: `*.*`
|
from: `*.*`
|
||||||
|
Reference in New Issue
Block a user