grasp/webpack.config.js

157 lines
4 KiB
JavaScript
Raw Normal View History

Collapse boilerplate in a single commit First prototype Added the README Fixed the hot module replacement Minor adjustments on readme Normalizing the env vars and using it capitalized Added info about the react.js branch Fix babel transpiling Using yarn Removing the babel package, just the babel-core does the job Using just the dependencies key on package.json Since it isn't a lib package doesn't matter the separation between devDependencies and dependencies. Updating the css-loader Updating the fs-extra Moving the utility packages to utils folder Better description Adds the license closes #3 Write the env vars on the bundle file http://dev.topheman.com/make-your-react-production-minified-version-with-webpack/ Fixs the hot reload setup Sringifies the env object to define plugin Uses the webpack html plugin to generate the pages in a less hacky way Uses the write-file-webpack-plugin this plugin allows the webpack write on disk all files, even running with the webserver, which is necessary to the hot reload. this plugin also help us to remove nasty hacks and expose bundles to other extension features. Allows exclude some entry points to be hot reloaded It's useful for content scripts that can't keep the connection with the webpack endpoint. Updates the webpack Updates the README with instructions about the content scripts resolves #4 Updates to Webpack 2 closes #8 Expand the DefinePlugin usage In Webpack 1, the replaced value at compile time by define plugin was placed with parenthesis, like ({"NODE_ENV":"development","PORT":3000}), now, it not works in this way, breaking the app. So, to simplify the things, this commit just passes the NODE_ENV var. Fix README Exclude /node_modules/ from babel and css transpiling #9 Source maps to help debugging closes #10 Removes the forbidden webpack config 'chromeExtensionBoilerplate' before build and webserver's start Although I know that it's not a good practice, right now I don't know a good way to keep the boilerplate configs simple as it is today without this hacky solution, so, until we came with a better solution, we'll remove the key before build and webserver's start. #9 Update README.md Removing babel.js Basically, we don't need transpiling with babel since Webpack 2 take care of ES6 modules transpiling and the ES2015 is supported by Chrome. kudos @gagarine resolve #16 Setup boilerplate to load images and other assets in html and css resolves #18 resolves #23 resolves #14 resolves #12 Added icons and images boilerplate Split dependencies on package.json resolves #15 Webpack config improvements (#26) - Use CopyWebpackPlugin to generate `manifest.json` file - Use CleanWebpackPlugin to clear build folder Minor README adjustments * explicitly the required node version * pointing to yarn install instructions page instead suggest install with npm. the yarn page will be always updated to the best way to install the yarn. closes #28 Adding the contribution guidelines
2016-04-14 06:16:50 -07:00
var webpack = require("webpack"),
path = require("path"),
fileSystem = require("fs"),
env = require("./utils/env"),
CleanWebpackPlugin = require("clean-webpack-plugin"),
CopyWebpackPlugin = require("copy-webpack-plugin"),
HtmlWebpackPlugin = require("html-webpack-plugin"),
2019-01-06 05:42:54 -08:00
WriteFilePlugin = require("write-file-webpack-plugin"),
WebpackExtensionManifestPlugin = require("webpack-extension-manifest-plugin");
const pkg = require('./package.json');
const baseManifest = require('./src/manifest.json');
Collapse boilerplate in a single commit First prototype Added the README Fixed the hot module replacement Minor adjustments on readme Normalizing the env vars and using it capitalized Added info about the react.js branch Fix babel transpiling Using yarn Removing the babel package, just the babel-core does the job Using just the dependencies key on package.json Since it isn't a lib package doesn't matter the separation between devDependencies and dependencies. Updating the css-loader Updating the fs-extra Moving the utility packages to utils folder Better description Adds the license closes #3 Write the env vars on the bundle file http://dev.topheman.com/make-your-react-production-minified-version-with-webpack/ Fixs the hot reload setup Sringifies the env object to define plugin Uses the webpack html plugin to generate the pages in a less hacky way Uses the write-file-webpack-plugin this plugin allows the webpack write on disk all files, even running with the webserver, which is necessary to the hot reload. this plugin also help us to remove nasty hacks and expose bundles to other extension features. Allows exclude some entry points to be hot reloaded It's useful for content scripts that can't keep the connection with the webpack endpoint. Updates the webpack Updates the README with instructions about the content scripts resolves #4 Updates to Webpack 2 closes #8 Expand the DefinePlugin usage In Webpack 1, the replaced value at compile time by define plugin was placed with parenthesis, like ({"NODE_ENV":"development","PORT":3000}), now, it not works in this way, breaking the app. So, to simplify the things, this commit just passes the NODE_ENV var. Fix README Exclude /node_modules/ from babel and css transpiling #9 Source maps to help debugging closes #10 Removes the forbidden webpack config 'chromeExtensionBoilerplate' before build and webserver's start Although I know that it's not a good practice, right now I don't know a good way to keep the boilerplate configs simple as it is today without this hacky solution, so, until we came with a better solution, we'll remove the key before build and webserver's start. #9 Update README.md Removing babel.js Basically, we don't need transpiling with babel since Webpack 2 take care of ES6 modules transpiling and the ES2015 is supported by Chrome. kudos @gagarine resolve #16 Setup boilerplate to load images and other assets in html and css resolves #18 resolves #23 resolves #14 resolves #12 Added icons and images boilerplate Split dependencies on package.json resolves #15 Webpack config improvements (#26) - Use CopyWebpackPlugin to generate `manifest.json` file - Use CleanWebpackPlugin to clear build folder Minor README adjustments * explicitly the required node version * pointing to yarn install instructions page instead suggest install with npm. the yarn page will be always updated to the best way to install the yarn. closes #28 Adding the contribution guidelines
2016-04-14 06:16:50 -07:00
const target = env.TARGET;
const pkg_name = env.ANY_HOST ? "grasp (any host)" : "grasp";
2019-01-18 16:41:27 -08:00
const permissions = [
"storage",
"notifications",
"activeTab",
"http://localhost/capture",
"https://localhost/capture"
];
if (env.ANY_HOST) {
permissions.push("https://*/capture");
}
2019-06-29 09:37:31 -07:00
// Firefox wouldn't let you rebind its default shortcuts most of which use Shift
// On the other hand, Chrome wouldn't let you use Alt
const modifier = target === 'chrome' ? 'Shift' : 'Alt';
// ugh. declarative formats are shit.
const commandsExtra = {
"capture-simple": {
"suggested_key": {
"default": `Ctrl+${modifier}+C`,
"mac": `Command+${modifier}+C`
}
},
"_execute_browser_action": {
"suggested_key": {
"default": `Ctrl+${modifier}+Y`,
"mac": `Command+${modifier}+Y`
}
},
};
const manifestExtra = {
name: pkg_name,
version: pkg.version,
description: pkg.description,
permissions: permissions,
2019-06-29 09:37:31 -07:00
commands: commandsExtra,
};
2019-06-29 09:37:31 -07:00
if (target === 'chrome') {
manifestExtra.options_ui = {chrome_style: true};
}
2019-06-29 09:37:31 -07:00
if (target === 'firefox') {
manifestExtra.options_ui = {browser_style: true};
manifestExtra.browser_action = {browser_style: true};
}
Collapse boilerplate in a single commit First prototype Added the README Fixed the hot module replacement Minor adjustments on readme Normalizing the env vars and using it capitalized Added info about the react.js branch Fix babel transpiling Using yarn Removing the babel package, just the babel-core does the job Using just the dependencies key on package.json Since it isn't a lib package doesn't matter the separation between devDependencies and dependencies. Updating the css-loader Updating the fs-extra Moving the utility packages to utils folder Better description Adds the license closes #3 Write the env vars on the bundle file http://dev.topheman.com/make-your-react-production-minified-version-with-webpack/ Fixs the hot reload setup Sringifies the env object to define plugin Uses the webpack html plugin to generate the pages in a less hacky way Uses the write-file-webpack-plugin this plugin allows the webpack write on disk all files, even running with the webserver, which is necessary to the hot reload. this plugin also help us to remove nasty hacks and expose bundles to other extension features. Allows exclude some entry points to be hot reloaded It's useful for content scripts that can't keep the connection with the webpack endpoint. Updates the webpack Updates the README with instructions about the content scripts resolves #4 Updates to Webpack 2 closes #8 Expand the DefinePlugin usage In Webpack 1, the replaced value at compile time by define plugin was placed with parenthesis, like ({"NODE_ENV":"development","PORT":3000}), now, it not works in this way, breaking the app. So, to simplify the things, this commit just passes the NODE_ENV var. Fix README Exclude /node_modules/ from babel and css transpiling #9 Source maps to help debugging closes #10 Removes the forbidden webpack config 'chromeExtensionBoilerplate' before build and webserver's start Although I know that it's not a good practice, right now I don't know a good way to keep the boilerplate configs simple as it is today without this hacky solution, so, until we came with a better solution, we'll remove the key before build and webserver's start. #9 Update README.md Removing babel.js Basically, we don't need transpiling with babel since Webpack 2 take care of ES6 modules transpiling and the ES2015 is supported by Chrome. kudos @gagarine resolve #16 Setup boilerplate to load images and other assets in html and css resolves #18 resolves #23 resolves #14 resolves #12 Added icons and images boilerplate Split dependencies on package.json resolves #15 Webpack config improvements (#26) - Use CopyWebpackPlugin to generate `manifest.json` file - Use CleanWebpackPlugin to clear build folder Minor README adjustments * explicitly the required node version * pointing to yarn install instructions page instead suggest install with npm. the yarn page will be always updated to the best way to install the yarn. closes #28 Adding the contribution guidelines
2016-04-14 06:16:50 -07:00
// load the secrets
var alias = {};
var secretsPath = path.join(__dirname, ("secrets." + env.NODE_ENV + ".js"));
var fileExtensions = ["jpg", "jpeg", "png", "gif", "eot", "otf", "svg", "ttf", "woff", "woff2"];
if (fileSystem.existsSync(secretsPath)) {
alias["secrets"] = secretsPath;
}
var options = {
2019-01-06 05:27:36 -08:00
mode: 'development',
Collapse boilerplate in a single commit First prototype Added the README Fixed the hot module replacement Minor adjustments on readme Normalizing the env vars and using it capitalized Added info about the react.js branch Fix babel transpiling Using yarn Removing the babel package, just the babel-core does the job Using just the dependencies key on package.json Since it isn't a lib package doesn't matter the separation between devDependencies and dependencies. Updating the css-loader Updating the fs-extra Moving the utility packages to utils folder Better description Adds the license closes #3 Write the env vars on the bundle file http://dev.topheman.com/make-your-react-production-minified-version-with-webpack/ Fixs the hot reload setup Sringifies the env object to define plugin Uses the webpack html plugin to generate the pages in a less hacky way Uses the write-file-webpack-plugin this plugin allows the webpack write on disk all files, even running with the webserver, which is necessary to the hot reload. this plugin also help us to remove nasty hacks and expose bundles to other extension features. Allows exclude some entry points to be hot reloaded It's useful for content scripts that can't keep the connection with the webpack endpoint. Updates the webpack Updates the README with instructions about the content scripts resolves #4 Updates to Webpack 2 closes #8 Expand the DefinePlugin usage In Webpack 1, the replaced value at compile time by define plugin was placed with parenthesis, like ({"NODE_ENV":"development","PORT":3000}), now, it not works in this way, breaking the app. So, to simplify the things, this commit just passes the NODE_ENV var. Fix README Exclude /node_modules/ from babel and css transpiling #9 Source maps to help debugging closes #10 Removes the forbidden webpack config 'chromeExtensionBoilerplate' before build and webserver's start Although I know that it's not a good practice, right now I don't know a good way to keep the boilerplate configs simple as it is today without this hacky solution, so, until we came with a better solution, we'll remove the key before build and webserver's start. #9 Update README.md Removing babel.js Basically, we don't need transpiling with babel since Webpack 2 take care of ES6 modules transpiling and the ES2015 is supported by Chrome. kudos @gagarine resolve #16 Setup boilerplate to load images and other assets in html and css resolves #18 resolves #23 resolves #14 resolves #12 Added icons and images boilerplate Split dependencies on package.json resolves #15 Webpack config improvements (#26) - Use CopyWebpackPlugin to generate `manifest.json` file - Use CleanWebpackPlugin to clear build folder Minor README adjustments * explicitly the required node version * pointing to yarn install instructions page instead suggest install with npm. the yarn page will be always updated to the best way to install the yarn. closes #28 Adding the contribution guidelines
2016-04-14 06:16:50 -07:00
entry: {
popup: path.join(__dirname, "src", "js", "popup.js"),
options: path.join(__dirname, "src", "js", "options_page.js"),
Collapse boilerplate in a single commit First prototype Added the README Fixed the hot module replacement Minor adjustments on readme Normalizing the env vars and using it capitalized Added info about the react.js branch Fix babel transpiling Using yarn Removing the babel package, just the babel-core does the job Using just the dependencies key on package.json Since it isn't a lib package doesn't matter the separation between devDependencies and dependencies. Updating the css-loader Updating the fs-extra Moving the utility packages to utils folder Better description Adds the license closes #3 Write the env vars on the bundle file http://dev.topheman.com/make-your-react-production-minified-version-with-webpack/ Fixs the hot reload setup Sringifies the env object to define plugin Uses the webpack html plugin to generate the pages in a less hacky way Uses the write-file-webpack-plugin this plugin allows the webpack write on disk all files, even running with the webserver, which is necessary to the hot reload. this plugin also help us to remove nasty hacks and expose bundles to other extension features. Allows exclude some entry points to be hot reloaded It's useful for content scripts that can't keep the connection with the webpack endpoint. Updates the webpack Updates the README with instructions about the content scripts resolves #4 Updates to Webpack 2 closes #8 Expand the DefinePlugin usage In Webpack 1, the replaced value at compile time by define plugin was placed with parenthesis, like ({"NODE_ENV":"development","PORT":3000}), now, it not works in this way, breaking the app. So, to simplify the things, this commit just passes the NODE_ENV var. Fix README Exclude /node_modules/ from babel and css transpiling #9 Source maps to help debugging closes #10 Removes the forbidden webpack config 'chromeExtensionBoilerplate' before build and webserver's start Although I know that it's not a good practice, right now I don't know a good way to keep the boilerplate configs simple as it is today without this hacky solution, so, until we came with a better solution, we'll remove the key before build and webserver's start. #9 Update README.md Removing babel.js Basically, we don't need transpiling with babel since Webpack 2 take care of ES6 modules transpiling and the ES2015 is supported by Chrome. kudos @gagarine resolve #16 Setup boilerplate to load images and other assets in html and css resolves #18 resolves #23 resolves #14 resolves #12 Added icons and images boilerplate Split dependencies on package.json resolves #15 Webpack config improvements (#26) - Use CopyWebpackPlugin to generate `manifest.json` file - Use CleanWebpackPlugin to clear build folder Minor README adjustments * explicitly the required node version * pointing to yarn install instructions page instead suggest install with npm. the yarn page will be always updated to the best way to install the yarn. closes #28 Adding the contribution guidelines
2016-04-14 06:16:50 -07:00
background: path.join(__dirname, "src", "js", "background.js")
},
output: {
path: path.join(__dirname, "build"),
filename: "[name].bundle.js"
},
module: {
rules: [
2019-01-04 13:27:24 -08:00
{
test: /\.js$/,
exclude: /node_modules/,
use: {
loader: 'babel-loader',
}
},
Collapse boilerplate in a single commit First prototype Added the README Fixed the hot module replacement Minor adjustments on readme Normalizing the env vars and using it capitalized Added info about the react.js branch Fix babel transpiling Using yarn Removing the babel package, just the babel-core does the job Using just the dependencies key on package.json Since it isn't a lib package doesn't matter the separation between devDependencies and dependencies. Updating the css-loader Updating the fs-extra Moving the utility packages to utils folder Better description Adds the license closes #3 Write the env vars on the bundle file http://dev.topheman.com/make-your-react-production-minified-version-with-webpack/ Fixs the hot reload setup Sringifies the env object to define plugin Uses the webpack html plugin to generate the pages in a less hacky way Uses the write-file-webpack-plugin this plugin allows the webpack write on disk all files, even running with the webserver, which is necessary to the hot reload. this plugin also help us to remove nasty hacks and expose bundles to other extension features. Allows exclude some entry points to be hot reloaded It's useful for content scripts that can't keep the connection with the webpack endpoint. Updates the webpack Updates the README with instructions about the content scripts resolves #4 Updates to Webpack 2 closes #8 Expand the DefinePlugin usage In Webpack 1, the replaced value at compile time by define plugin was placed with parenthesis, like ({"NODE_ENV":"development","PORT":3000}), now, it not works in this way, breaking the app. So, to simplify the things, this commit just passes the NODE_ENV var. Fix README Exclude /node_modules/ from babel and css transpiling #9 Source maps to help debugging closes #10 Removes the forbidden webpack config 'chromeExtensionBoilerplate' before build and webserver's start Although I know that it's not a good practice, right now I don't know a good way to keep the boilerplate configs simple as it is today without this hacky solution, so, until we came with a better solution, we'll remove the key before build and webserver's start. #9 Update README.md Removing babel.js Basically, we don't need transpiling with babel since Webpack 2 take care of ES6 modules transpiling and the ES2015 is supported by Chrome. kudos @gagarine resolve #16 Setup boilerplate to load images and other assets in html and css resolves #18 resolves #23 resolves #14 resolves #12 Added icons and images boilerplate Split dependencies on package.json resolves #15 Webpack config improvements (#26) - Use CopyWebpackPlugin to generate `manifest.json` file - Use CleanWebpackPlugin to clear build folder Minor README adjustments * explicitly the required node version * pointing to yarn install instructions page instead suggest install with npm. the yarn page will be always updated to the best way to install the yarn. closes #28 Adding the contribution guidelines
2016-04-14 06:16:50 -07:00
{
test: /\.css$/,
loader: "style-loader!css-loader",
exclude: /node_modules/
},
{
test: new RegExp('\.(' + fileExtensions.join('|') + ')$'),
loader: "file-loader?name=[name].[ext]",
exclude: /node_modules/
},
{
test: /\.html$/,
loader: "html-loader",
exclude: /node_modules/
}
]
},
resolve: {
alias: alias
},
plugins: [
// clean the build folder
new CleanWebpackPlugin(["build/*"]),
2019-01-06 14:15:53 -08:00
new CopyWebpackPlugin([
{ from: 'src/img/*.png', flatten: true },
2019-01-06 14:15:53 -08:00
]),
Collapse boilerplate in a single commit First prototype Added the README Fixed the hot module replacement Minor adjustments on readme Normalizing the env vars and using it capitalized Added info about the react.js branch Fix babel transpiling Using yarn Removing the babel package, just the babel-core does the job Using just the dependencies key on package.json Since it isn't a lib package doesn't matter the separation between devDependencies and dependencies. Updating the css-loader Updating the fs-extra Moving the utility packages to utils folder Better description Adds the license closes #3 Write the env vars on the bundle file http://dev.topheman.com/make-your-react-production-minified-version-with-webpack/ Fixs the hot reload setup Sringifies the env object to define plugin Uses the webpack html plugin to generate the pages in a less hacky way Uses the write-file-webpack-plugin this plugin allows the webpack write on disk all files, even running with the webserver, which is necessary to the hot reload. this plugin also help us to remove nasty hacks and expose bundles to other extension features. Allows exclude some entry points to be hot reloaded It's useful for content scripts that can't keep the connection with the webpack endpoint. Updates the webpack Updates the README with instructions about the content scripts resolves #4 Updates to Webpack 2 closes #8 Expand the DefinePlugin usage In Webpack 1, the replaced value at compile time by define plugin was placed with parenthesis, like ({"NODE_ENV":"development","PORT":3000}), now, it not works in this way, breaking the app. So, to simplify the things, this commit just passes the NODE_ENV var. Fix README Exclude /node_modules/ from babel and css transpiling #9 Source maps to help debugging closes #10 Removes the forbidden webpack config 'chromeExtensionBoilerplate' before build and webserver's start Although I know that it's not a good practice, right now I don't know a good way to keep the boilerplate configs simple as it is today without this hacky solution, so, until we came with a better solution, we'll remove the key before build and webserver's start. #9 Update README.md Removing babel.js Basically, we don't need transpiling with babel since Webpack 2 take care of ES6 modules transpiling and the ES2015 is supported by Chrome. kudos @gagarine resolve #16 Setup boilerplate to load images and other assets in html and css resolves #18 resolves #23 resolves #14 resolves #12 Added icons and images boilerplate Split dependencies on package.json resolves #15 Webpack config improvements (#26) - Use CopyWebpackPlugin to generate `manifest.json` file - Use CleanWebpackPlugin to clear build folder Minor README adjustments * explicitly the required node version * pointing to yarn install instructions page instead suggest install with npm. the yarn page will be always updated to the best way to install the yarn. closes #28 Adding the contribution guidelines
2016-04-14 06:16:50 -07:00
// expose and write the allowed env vars on the compiled bundle
new webpack.DefinePlugin({
"process.env.NODE_ENV": JSON.stringify(env.NODE_ENV)
}),
2019-01-06 05:42:54 -08:00
new WebpackExtensionManifestPlugin({
config: {
base: baseManifest,
extend: manifestExtra,
2019-01-06 05:42:54 -08:00
}
}),
Collapse boilerplate in a single commit First prototype Added the README Fixed the hot module replacement Minor adjustments on readme Normalizing the env vars and using it capitalized Added info about the react.js branch Fix babel transpiling Using yarn Removing the babel package, just the babel-core does the job Using just the dependencies key on package.json Since it isn't a lib package doesn't matter the separation between devDependencies and dependencies. Updating the css-loader Updating the fs-extra Moving the utility packages to utils folder Better description Adds the license closes #3 Write the env vars on the bundle file http://dev.topheman.com/make-your-react-production-minified-version-with-webpack/ Fixs the hot reload setup Sringifies the env object to define plugin Uses the webpack html plugin to generate the pages in a less hacky way Uses the write-file-webpack-plugin this plugin allows the webpack write on disk all files, even running with the webserver, which is necessary to the hot reload. this plugin also help us to remove nasty hacks and expose bundles to other extension features. Allows exclude some entry points to be hot reloaded It's useful for content scripts that can't keep the connection with the webpack endpoint. Updates the webpack Updates the README with instructions about the content scripts resolves #4 Updates to Webpack 2 closes #8 Expand the DefinePlugin usage In Webpack 1, the replaced value at compile time by define plugin was placed with parenthesis, like ({"NODE_ENV":"development","PORT":3000}), now, it not works in this way, breaking the app. So, to simplify the things, this commit just passes the NODE_ENV var. Fix README Exclude /node_modules/ from babel and css transpiling #9 Source maps to help debugging closes #10 Removes the forbidden webpack config 'chromeExtensionBoilerplate' before build and webserver's start Although I know that it's not a good practice, right now I don't know a good way to keep the boilerplate configs simple as it is today without this hacky solution, so, until we came with a better solution, we'll remove the key before build and webserver's start. #9 Update README.md Removing babel.js Basically, we don't need transpiling with babel since Webpack 2 take care of ES6 modules transpiling and the ES2015 is supported by Chrome. kudos @gagarine resolve #16 Setup boilerplate to load images and other assets in html and css resolves #18 resolves #23 resolves #14 resolves #12 Added icons and images boilerplate Split dependencies on package.json resolves #15 Webpack config improvements (#26) - Use CopyWebpackPlugin to generate `manifest.json` file - Use CleanWebpackPlugin to clear build folder Minor README adjustments * explicitly the required node version * pointing to yarn install instructions page instead suggest install with npm. the yarn page will be always updated to the best way to install the yarn. closes #28 Adding the contribution guidelines
2016-04-14 06:16:50 -07:00
new HtmlWebpackPlugin({
template: path.join(__dirname, "src", "popup.html"),
filename: "popup.html",
2019-01-06 12:44:00 -08:00
chunks: ["popup"],
Collapse boilerplate in a single commit First prototype Added the README Fixed the hot module replacement Minor adjustments on readme Normalizing the env vars and using it capitalized Added info about the react.js branch Fix babel transpiling Using yarn Removing the babel package, just the babel-core does the job Using just the dependencies key on package.json Since it isn't a lib package doesn't matter the separation between devDependencies and dependencies. Updating the css-loader Updating the fs-extra Moving the utility packages to utils folder Better description Adds the license closes #3 Write the env vars on the bundle file http://dev.topheman.com/make-your-react-production-minified-version-with-webpack/ Fixs the hot reload setup Sringifies the env object to define plugin Uses the webpack html plugin to generate the pages in a less hacky way Uses the write-file-webpack-plugin this plugin allows the webpack write on disk all files, even running with the webserver, which is necessary to the hot reload. this plugin also help us to remove nasty hacks and expose bundles to other extension features. Allows exclude some entry points to be hot reloaded It's useful for content scripts that can't keep the connection with the webpack endpoint. Updates the webpack Updates the README with instructions about the content scripts resolves #4 Updates to Webpack 2 closes #8 Expand the DefinePlugin usage In Webpack 1, the replaced value at compile time by define plugin was placed with parenthesis, like ({"NODE_ENV":"development","PORT":3000}), now, it not works in this way, breaking the app. So, to simplify the things, this commit just passes the NODE_ENV var. Fix README Exclude /node_modules/ from babel and css transpiling #9 Source maps to help debugging closes #10 Removes the forbidden webpack config 'chromeExtensionBoilerplate' before build and webserver's start Although I know that it's not a good practice, right now I don't know a good way to keep the boilerplate configs simple as it is today without this hacky solution, so, until we came with a better solution, we'll remove the key before build and webserver's start. #9 Update README.md Removing babel.js Basically, we don't need transpiling with babel since Webpack 2 take care of ES6 modules transpiling and the ES2015 is supported by Chrome. kudos @gagarine resolve #16 Setup boilerplate to load images and other assets in html and css resolves #18 resolves #23 resolves #14 resolves #12 Added icons and images boilerplate Split dependencies on package.json resolves #15 Webpack config improvements (#26) - Use CopyWebpackPlugin to generate `manifest.json` file - Use CleanWebpackPlugin to clear build folder Minor README adjustments * explicitly the required node version * pointing to yarn install instructions page instead suggest install with npm. the yarn page will be always updated to the best way to install the yarn. closes #28 Adding the contribution guidelines
2016-04-14 06:16:50 -07:00
}),
new HtmlWebpackPlugin({
template: path.join(__dirname, "src", "options.html"),
filename: "options.html",
chunks: ["options"]
}),
new HtmlWebpackPlugin({
template: path.join(__dirname, "src", "background.html"),
filename: "background.html",
chunks: ["background"]
}),
new WriteFilePlugin()
]
};
if (env.NODE_ENV === "development") {
options.devtool = "cheap-module-eval-source-map";
}
module.exports = options;