refactor: move views html around

This commit is contained in:
abhijithvijayan 2020-01-27 19:21:43 +05:30
parent 87e6f427de
commit f651a826d8
3 changed files with 16 additions and 13 deletions

View File

@ -6,6 +6,7 @@
<title>Options</title>
<link rel="stylesheet" href="css/options.css" />
</head>
<body></body>
<body>
<div id="options-root"></div>
</body>
</html>

View File

@ -2,10 +2,11 @@
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="viewport" content="width=500" />
<title>Popup</title>
<link rel="stylesheet" href="css/popup.css" />
</head>
<body></body>
<body>
<div id="popup-root"></div>
</body>
</html>

View File

@ -12,6 +12,7 @@ const FixStyleOnlyEntriesPlugin = require('webpack-fix-style-only-entries');
const manifestInput = require('./src/manifest');
const viewsPath = path.join(__dirname, 'views');
const nodeEnv = process.env.NODE_ENV || 'development';
const targetBrowser = process.env.TARGET_BROWSER;
const manifest = wextManifest[targetBrowser](manifestInput);
@ -125,17 +126,17 @@ module.exports = {
verbose: true,
}),
new HtmlWebpackPlugin({
template: 'src/options.html',
// inject: false,
chunks: ['options'],
filename: 'options.html',
}),
new HtmlWebpackPlugin({
template: 'src/popup.html',
// inject: false,
template: path.join(viewsPath, 'popup.html'),
inject: 'body',
chunks: ['popup'],
filename: 'popup.html',
}),
new HtmlWebpackPlugin({
template: path.join(viewsPath, 'options.html'),
inject: 'body',
chunks: ['options'],
filename: 'options.html',
}),
new CopyWebpackPlugin([{ from: 'src/assets', to: 'assets' }]),
new WriteWebpackPlugin([{ name: manifest.name, data: Buffer.from(manifest.content) }]),
extensionReloaderPlugin,