-
Notifications
You must be signed in to change notification settings - Fork 75
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixes #1
- Loading branch information
Showing
13 changed files
with
11,510 additions
and
17,240 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
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
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,12 @@ | ||
{ | ||
"name": "index-html", | ||
"version": "1.0.0", | ||
"description": "", | ||
"main": "webpack.config.js", | ||
"scripts": { | ||
"build": "../../node_modules/.bin/webpack --mode production" | ||
}, | ||
"keywords": [], | ||
"author": "", | ||
"license": "ISC" | ||
} |
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,49 +1,50 @@ | ||
var path = require("path"); | ||
"use strict"; | ||
|
||
var indexHtml = path.join(__dirname, "app", "index.html"); | ||
module.exports = ({ mode }) => { | ||
const pathToMainJs = require.resolve("./app/main.js"); | ||
const pathToIndexHtml = require.resolve("./app/index.html"); | ||
|
||
module.exports = { | ||
mode: "development", | ||
entry: [ | ||
path.join(__dirname, "app", "main.js"), | ||
indexHtml | ||
], | ||
output: { | ||
path: path.join(__dirname, "dist"), | ||
filename: "bundle.js" | ||
}, | ||
module: { | ||
rules: [ | ||
{ | ||
test: indexHtml, | ||
use: [ | ||
{ | ||
loader: "file-loader", | ||
options: { | ||
name: "[name].[ext]" | ||
return { | ||
mode, | ||
entry: [ | ||
pathToMainJs, | ||
pathToIndexHtml | ||
], | ||
module: { | ||
rules: [ | ||
{ | ||
test: pathToIndexHtml, | ||
use: [ | ||
"file-loader", | ||
// should be just "extract-loader" in your case | ||
require.resolve("../../lib/extractLoader.js"), | ||
{ | ||
loader: "html-loader", | ||
options: { | ||
attrs: ["img:src", "link:href"] | ||
} | ||
} | ||
}, | ||
path.resolve(__dirname, "..", "..", "lib", "extractLoader.js"), | ||
{ | ||
loader: "html-loader", | ||
options: { | ||
attrs: ["img:src", "link:href"] | ||
] | ||
}, | ||
{ | ||
test: /\.css$/, | ||
use: [ | ||
"file-loader", | ||
// should be just "extract-loader" in your case | ||
require.resolve("../../lib/extractLoader.js"), | ||
{ | ||
loader: "css-loader", | ||
options: { | ||
sourceMap: true | ||
} | ||
} | ||
} | ||
] | ||
}, | ||
{ | ||
test: /\.css$/, | ||
use: [ | ||
"file-loader", | ||
path.resolve(__dirname, "..", "..", "lib", "extractLoader.js"), | ||
"css-loader" | ||
] | ||
}, | ||
{ | ||
test: /\.jpg$/, | ||
use: "file-loader" | ||
} | ||
] | ||
} | ||
] | ||
}, | ||
{ | ||
test: /\.jpg$/, | ||
use: "file-loader" | ||
} | ||
] | ||
} | ||
}; | ||
}; |
This file was deleted.
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
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,12 @@ | ||
{ | ||
This comment has been minimized.
Sorry, something went wrong. |
||
"name": "main-css", | ||
"version": "1.0.0", | ||
"description": "", | ||
"main": "webpack.config.js", | ||
"scripts": { | ||
"build": "../../node_modules/.bin/webpack --mode production" | ||
}, | ||
"keywords": [], | ||
"author": "", | ||
"license": "ISC" | ||
} |
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,25 +1,34 @@ | ||
var path = require("path"); | ||
"use strict"; | ||
|
||
var live = process.env.NODE_ENV === "production"; | ||
var mainCss = ["css-loader", path.join(__dirname, "app", "main.css")]; | ||
module.exports = ({ mode }) => { | ||
const pathToMainCss = require.resolve("./app/main.css"); | ||
const loaders = [{ | ||
loader: "css-loader", | ||
options: { | ||
sourceMap: true | ||
} | ||
}]; | ||
|
||
if (live) { | ||
mainCss.unshift( | ||
"file-loader?name=[name].[ext]", | ||
path.resolve(__dirname, "..", "..", "lib", "extractLoader.js") // should be just "extract" in your case | ||
); | ||
} else { | ||
mainCss.unshift("style-loader"); | ||
} | ||
|
||
module.exports = { | ||
mode: live ? "production" : "development", | ||
entry: [ | ||
path.join(__dirname, "app", "main.js"), | ||
mainCss.join("!") | ||
], | ||
output: { | ||
path: path.join(__dirname, "dist"), | ||
filename: "bundle.js" | ||
if (mode === "production") { | ||
loaders.unshift( | ||
"file-loader", | ||
// should be just "extract-loader" in your case | ||
require.resolve("../../lib/extractLoader.js"), | ||
); | ||
} else { | ||
loaders.unshift("style-loader"); | ||
} | ||
|
||
return { | ||
mode, | ||
entry: pathToMainCss, | ||
module: { | ||
rules: [ | ||
{ | ||
test: pathToMainCss, | ||
loaders: loaders | ||
}, | ||
] | ||
} | ||
}; | ||
}; |
Oops, something went wrong.
"name": "main-css",
"version": "1.0.0",
"description": "",
"main": "webpack.config.js",
"scripts": {
"build": "../../node_modules/.bin/webpack --mode production"
},
"keywords": [],
"author": "",
"license": "ISC"
}