mirror of
https://github.com/kevin-DL/sapper.git
synced 2026-01-21 14:55:04 +00:00
update webpack/config
This commit is contained in:
@@ -19,4 +19,3 @@ install:
|
|||||||
- export DISPLAY=':99.0'
|
- export DISPLAY=':99.0'
|
||||||
- Xvfb :99 -screen 0 1024x768x24 > /dev/null 2>&1 &
|
- Xvfb :99 -screen 0 1024x768x24 > /dev/null 2>&1 &
|
||||||
- npm install
|
- npm install
|
||||||
- (cd test/app && npm install)
|
|
||||||
|
|||||||
@@ -39,8 +39,7 @@
|
|||||||
"source-map-support": "^0.5.3",
|
"source-map-support": "^0.5.3",
|
||||||
"tslib": "^1.8.1",
|
"tslib": "^1.8.1",
|
||||||
"url-parse": "^1.2.0",
|
"url-parse": "^1.2.0",
|
||||||
"walk-sync": "^0.3.2",
|
"walk-sync": "^0.3.2"
|
||||||
"webpack": "^3.10.0"
|
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@std/esm": "^0.19.7",
|
"@std/esm": "^0.19.7",
|
||||||
@@ -63,7 +62,8 @@
|
|||||||
"svelte": "^1.49.1",
|
"svelte": "^1.49.1",
|
||||||
"svelte-loader": "^2.3.2",
|
"svelte-loader": "^2.3.2",
|
||||||
"ts-node": "^4.1.0",
|
"ts-node": "^4.1.0",
|
||||||
"typescript": "^2.6.2"
|
"typescript": "^2.6.2",
|
||||||
|
"webpack": "^4.1.0"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"cy:open": "cypress open",
|
"cy:open": "cypress open",
|
||||||
|
|||||||
@@ -6,12 +6,7 @@ export default {
|
|||||||
client: {
|
client: {
|
||||||
entry: () => {
|
entry: () => {
|
||||||
return {
|
return {
|
||||||
main: [
|
main: './app/client.js'
|
||||||
'./app/client.js',
|
|
||||||
// workaround for https://github.com/webpack-contrib/extract-text-webpack-plugin/issues/456
|
|
||||||
'style-loader/lib/addStyles',
|
|
||||||
'css-loader/lib/css-base'
|
|
||||||
]
|
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -34,11 +29,27 @@ export default {
|
|||||||
|
|
||||||
output: () => {
|
output: () => {
|
||||||
return {
|
return {
|
||||||
path: `${dest()}`,
|
path: dest(),
|
||||||
filename: '[name].js',
|
filename: '[name].js',
|
||||||
chunkFilename: '[hash]/[name].[id].js',
|
chunkFilename: '[hash]/[name].[id].js',
|
||||||
libraryTarget: 'commonjs2'
|
libraryTarget: 'commonjs2'
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
serviceworker: {
|
||||||
|
entry: () => {
|
||||||
|
return {
|
||||||
|
'service-worker': './app/service-worker.js'
|
||||||
|
};
|
||||||
|
},
|
||||||
|
|
||||||
|
output: () => {
|
||||||
|
return {
|
||||||
|
path: dest(),
|
||||||
|
filename: '[name].js',
|
||||||
|
chunkFilename: '[name].[id].[hash].js'
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -23,6 +23,6 @@
|
|||||||
"svelte": "^1.56.0",
|
"svelte": "^1.56.0",
|
||||||
"svelte-loader": "^2.3.3",
|
"svelte-loader": "^2.3.3",
|
||||||
"uglifyjs-webpack-plugin": "^1.2.2",
|
"uglifyjs-webpack-plugin": "^1.2.2",
|
||||||
"webpack": "^3.11.0"
|
"webpack": "^4.1.0"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,8 +1,11 @@
|
|||||||
const config = require('../../../webpack/config.js');
|
const config = require('../../../webpack/config.js');
|
||||||
const webpack = require('webpack');
|
const webpack = require('webpack');
|
||||||
|
|
||||||
|
const mode = process.env.NODE_ENV;
|
||||||
|
const isDev = mode === 'development';
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
entry: './app/client.js',
|
entry: config.client.entry(),
|
||||||
output: config.client.output(),
|
output: config.client.output(),
|
||||||
resolve: {
|
resolve: {
|
||||||
extensions: ['.js', '.html']
|
extensions: ['.js', '.html']
|
||||||
@@ -16,24 +19,16 @@ module.exports = {
|
|||||||
loader: 'svelte-loader',
|
loader: 'svelte-loader',
|
||||||
options: {
|
options: {
|
||||||
hydratable: true,
|
hydratable: true,
|
||||||
emitCss: !config.dev,
|
|
||||||
cascade: false,
|
cascade: false,
|
||||||
store: true
|
store: true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
|
||||||
{
|
|
||||||
test: /\.css$/,
|
|
||||||
use: [
|
|
||||||
{ loader: "style-loader" },
|
|
||||||
{ loader: "css-loader" }
|
|
||||||
]
|
|
||||||
}
|
}
|
||||||
].filter(Boolean)
|
]
|
||||||
},
|
},
|
||||||
|
mode,
|
||||||
plugins: [
|
plugins: [
|
||||||
config.dev && new webpack.HotModuleReplacementPlugin(),
|
isDev && new webpack.HotModuleReplacementPlugin()
|
||||||
!config.dev && new webpack.optimize.ModuleConcatenationPlugin()
|
|
||||||
].filter(Boolean),
|
].filter(Boolean),
|
||||||
devtool: config.dev ? 'inline-source-map' : false
|
devtool: isDev && 'inline-source-map'
|
||||||
};
|
};
|
||||||
@@ -3,9 +3,7 @@ const pkg = require('../package.json');
|
|||||||
const sapper_pkg = require('../../../package.json');
|
const sapper_pkg = require('../../../package.json');
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
entry: {
|
entry: config.server.entry(),
|
||||||
'server': './app/server.js'
|
|
||||||
},
|
|
||||||
output: config.server.output(),
|
output: config.server.output(),
|
||||||
target: 'node',
|
target: 'node',
|
||||||
resolve: {
|
resolve: {
|
||||||
@@ -28,5 +26,9 @@ module.exports = {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
},
|
||||||
|
mode: process.env.NODE_ENV,
|
||||||
|
performance: {
|
||||||
|
hints: false // it doesn't matter if server.js is large
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -1,17 +1,7 @@
|
|||||||
const path = require('path');
|
|
||||||
const config = require('../../../webpack/config.js');
|
const config = require('../../../webpack/config.js');
|
||||||
const webpack = require('webpack');
|
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
entry: {
|
entry: config.serviceworker.entry(),
|
||||||
'service-worker': './app/service-worker.js'
|
output: config.serviceworker.output(),
|
||||||
},
|
mode: process.env.NODE_ENV
|
||||||
output: {
|
|
||||||
path: path.resolve(`.sapper`),
|
|
||||||
filename: '[name].js',
|
|
||||||
chunkFilename: '[name].[id].[hash].js'
|
|
||||||
},
|
|
||||||
plugins: [
|
|
||||||
!config.dev && new webpack.optimize.ModuleConcatenationPlugin()
|
|
||||||
].filter(Boolean)
|
|
||||||
};
|
};
|
||||||
Reference in New Issue
Block a user