Make extention acceptable by Edge Add-Ons website
This commit is contained in:
10
config/paths.js
Normal file
10
config/paths.js
Normal file
@ -0,0 +1,10 @@
|
||||
'use strict';
|
||||
|
||||
const path = require('path');
|
||||
|
||||
const PATHS = {
|
||||
src: path.resolve(__dirname, '../src'),
|
||||
build: path.resolve(__dirname, '../build'),
|
||||
};
|
||||
|
||||
module.exports = PATHS;
|
58
config/webpack.common.js
Normal file
58
config/webpack.common.js
Normal file
@ -0,0 +1,58 @@
|
||||
'use strict';
|
||||
|
||||
const SizePlugin = require('size-plugin');
|
||||
const CopyWebpackPlugin = require('copy-webpack-plugin');
|
||||
|
||||
const PATHS = require('./paths');
|
||||
const { ProvidePlugin } = require('webpack');
|
||||
|
||||
// To re-use webpack configuration across templates,
|
||||
// CLI maintains a common webpack configuration file - `webpack.common.js`.
|
||||
// Whenever user creates an extension, CLI adds `webpack.common.js` file
|
||||
// in template's `config` folder
|
||||
const common = {
|
||||
output: {
|
||||
// the build folder to output bundles and assets in.
|
||||
path: PATHS.build,
|
||||
// the filename template for entry chunks
|
||||
filename: '[name].js',
|
||||
},
|
||||
devtool: 'source-map',
|
||||
stats: {
|
||||
all: false,
|
||||
errors: true,
|
||||
builtAt: true,
|
||||
},
|
||||
module: {
|
||||
rules: [
|
||||
// Check for images imported in .js files and
|
||||
{
|
||||
test: /\.(png|jpe?g|gif)$/i,
|
||||
use: [
|
||||
{
|
||||
loader: 'file-loader',
|
||||
options: {
|
||||
outputPath: 'images',
|
||||
name: '[name].[ext]',
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
plugins: [
|
||||
// Print file sizes
|
||||
new SizePlugin(),
|
||||
// Copy static assets from `public` folder to `build` folder
|
||||
new CopyWebpackPlugin({
|
||||
patterns: [
|
||||
{
|
||||
from: '**/*',
|
||||
context: 'public',
|
||||
},
|
||||
]
|
||||
}),
|
||||
],
|
||||
};
|
||||
|
||||
module.exports = common;
|
18
config/webpack.config.js
Normal file
18
config/webpack.config.js
Normal file
@ -0,0 +1,18 @@
|
||||
'use strict';
|
||||
|
||||
const { merge } = require('webpack-merge');
|
||||
|
||||
const common = require('./webpack.common.js');
|
||||
const PATHS = require('./paths');
|
||||
|
||||
// Merge webpack configuration files
|
||||
const config = merge(common, {
|
||||
entry: {
|
||||
popup: PATHS.src + '/popup.js',
|
||||
service_worker: PATHS.src + '/service_worker.js',
|
||||
contentScript: PATHS.src + '/contentScript.js',
|
||||
jquery: 'jquery',
|
||||
},
|
||||
});
|
||||
|
||||
module.exports = config;
|
Reference in New Issue
Block a user