-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: first pass at setting up webpack * chore: adding support for dev-server * chore: prettier linting Co-authored-by: Gabe Ratcliff <[email protected]>
- Loading branch information
Showing
8 changed files
with
5,536 additions
and
255 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
dist/ | ||
node_modules/ | ||
coverage/ |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
<head> | ||
<meta charset="UTF-8"> | ||
<title>Syntax Highlighter</title> | ||
<link rel="icon" type="image/png" href="./favicon.ico"/> | ||
</head> | ||
<div id="root" /> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import ReactDOM from 'react-dom'; | ||
import syntaxHighlighter from '../src/index'; | ||
|
||
ReactDOM.render( | ||
syntaxHighlighter('console.log("Hello, world!");', 'js', { dark: true }), | ||
document.getElementById('root') | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
const HtmlWebPackPlugin = require('html-webpack-plugin'); | ||
const path = require('path'); | ||
|
||
module.exports = { | ||
entry: ['./public/index.js'], | ||
module: { | ||
rules: [ | ||
{ | ||
test: /\.js(x?)$/, | ||
use: { | ||
loader: 'babel-loader', | ||
options: { | ||
extends: './.babelrc', | ||
}, | ||
}, | ||
}, | ||
], | ||
}, | ||
output: { | ||
path: path.resolve(__dirname, 'dist'), | ||
filename: 'index.js', | ||
publicPath: '/', | ||
}, | ||
resolve: { | ||
extensions: ['.js', '.jsx'], | ||
}, | ||
plugins: [ | ||
new HtmlWebPackPlugin({ | ||
template: path.resolve(__dirname, 'public/index.html'), | ||
filename: 'index.html', | ||
}), | ||
], | ||
devServer: { | ||
contentBase: path.join(__dirname, 'dist'), | ||
compress: true, | ||
port: 3400, | ||
hot: true, | ||
watchContentBase: true, | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
const TerserPlugin = require('terser-webpack-plugin'); | ||
const path = require('path'); | ||
|
||
module.exports = { | ||
entry: ['./src/index.js'], | ||
module: { | ||
rules: [ | ||
{ | ||
test: /\.js(x?)$/, | ||
use: { | ||
loader: 'babel-loader', | ||
options: { | ||
extends: './.babelrc', | ||
}, | ||
}, | ||
}, | ||
], | ||
}, | ||
optimization: { | ||
minimize: true, | ||
minimizer: [new TerserPlugin()], | ||
}, | ||
output: { | ||
path: path.resolve(__dirname, 'dist'), | ||
filename: 'index.js', | ||
libraryTarget: 'commonjs2', | ||
}, | ||
resolve: { | ||
extensions: ['.js', '.jsx'], | ||
}, | ||
}; |