Merge pull request #1148 from h3poteto/iss-901
refs #901 Stop to specify libraryTarget for renderer in webpack
This commit is contained in:
commit
1ec4fd4fa8
6
.babelrc
6
.babelrc
|
@ -4,7 +4,7 @@
|
|||
"test": {
|
||||
"presets": [
|
||||
["@babel/preset-env", {
|
||||
"targets": { "node": 9 }
|
||||
"targets": { "node": 10 }
|
||||
}]
|
||||
],
|
||||
"plugins": [
|
||||
|
@ -17,7 +17,7 @@
|
|||
"main": {
|
||||
"presets": [
|
||||
["@babel/preset-env", {
|
||||
"targets": { "node": 9 }
|
||||
"targets": { "node": 10 }
|
||||
}]
|
||||
],
|
||||
"plugins": [
|
||||
|
@ -30,7 +30,7 @@
|
|||
"presets": [
|
||||
["@babel/preset-env", {
|
||||
"modules": false,
|
||||
"targets": { "node": "current" }
|
||||
"targets": { "electron": "6" }
|
||||
}]
|
||||
],
|
||||
"plugins": [
|
||||
|
|
|
@ -12,23 +12,11 @@ const MiniCssExtractPlugin = require('mini-css-extract-plugin')
|
|||
const HtmlWebpackPlugin = require('html-webpack-plugin')
|
||||
const { VueLoaderPlugin } = require('vue-loader')
|
||||
|
||||
/**
|
||||
* List of node_modules to include in webpack bundle
|
||||
*
|
||||
* Required for specific packages like Vue UI libraries
|
||||
* that provide pure *.vue files that need compiling
|
||||
* https://simulatedgreg.gitbooks.io/electron-vue/content/en/webpack-configurations.html#white-listing-externals
|
||||
*/
|
||||
let whiteListedModules = ['vue']
|
||||
|
||||
let rendererConfig = {
|
||||
devtool: '#cheap-module-eval-source-map',
|
||||
entry: {
|
||||
renderer: path.join(__dirname, '../src/renderer/main.ts')
|
||||
},
|
||||
externals: [
|
||||
...Object.keys(dependencies || {}).filter(d => !whiteListedModules.includes(d))
|
||||
],
|
||||
module: {
|
||||
rules: [
|
||||
{
|
||||
|
@ -138,7 +126,7 @@ let rendererConfig = {
|
|||
},
|
||||
plugins: [
|
||||
new VueLoaderPlugin(),
|
||||
new MiniCssExtractPlugin({filename: 'styles.css'}),
|
||||
new MiniCssExtractPlugin({ filename: 'styles.css' }),
|
||||
new HtmlWebpackPlugin({
|
||||
filename: 'index.html',
|
||||
template: path.resolve(__dirname, '../src/index.ejs'),
|
||||
|
@ -147,16 +135,13 @@ let rendererConfig = {
|
|||
removeAttributeQuotes: true,
|
||||
removeComments: true
|
||||
},
|
||||
nodeModules: process.env.NODE_ENV !== 'production'
|
||||
? path.resolve(__dirname, '../node_modules')
|
||||
: false
|
||||
nodeModules: process.env.NODE_ENV !== 'production' ? path.resolve(__dirname, '../node_modules') : false
|
||||
}),
|
||||
new webpack.HotModuleReplacementPlugin(),
|
||||
new webpack.NoEmitOnErrorsPlugin()
|
||||
],
|
||||
output: {
|
||||
filename: '[name].js',
|
||||
libraryTarget: 'commonjs2',
|
||||
path: path.join(__dirname, '../dist/electron')
|
||||
},
|
||||
resolve: {
|
||||
|
@ -164,7 +149,7 @@ let rendererConfig = {
|
|||
// Same as tsconfig.json
|
||||
'@': path.join(__dirname, '../src/renderer'),
|
||||
'~': path.join(__dirname, '../'),
|
||||
'vue$': 'vue/dist/vue.esm.js'
|
||||
vue$: 'vue/dist/vue.esm.js'
|
||||
},
|
||||
extensions: ['.ts', '.js', '.vue', '.json', '.css', '.node']
|
||||
},
|
||||
|
@ -177,7 +162,7 @@ let rendererConfig = {
|
|||
if (process.env.NODE_ENV !== 'production') {
|
||||
rendererConfig.plugins.push(
|
||||
new webpack.DefinePlugin({
|
||||
'__static': `"${path.join(__dirname, '../static').replace(/\\/g, '\\\\')}"`
|
||||
__static: `"${path.join(__dirname, '../static').replace(/\\/g, '\\\\')}"`
|
||||
})
|
||||
)
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"compilerOptions": {
|
||||
"target": "es5",
|
||||
"module": "es2015",
|
||||
"target": "es6",
|
||||
"module": "esnext",
|
||||
"lib": [
|
||||
"dom",
|
||||
"dom.iterable",
|
||||
|
|
Loading…
Reference in New Issue