Merge pull request #8364 from ahocevar/ie-examples
Make examples work in IE11
This commit is contained in:
committed by
ahocevar
parent
d1a609e0a3
commit
871a283601
@@ -18,6 +18,18 @@ module.exports = {
|
|||||||
context: src,
|
context: src,
|
||||||
target: 'web',
|
target: 'web',
|
||||||
entry: entry,
|
entry: entry,
|
||||||
|
module: {
|
||||||
|
rules: [{
|
||||||
|
use: {
|
||||||
|
loader: 'buble-loader'
|
||||||
|
},
|
||||||
|
test: /\.js$/,
|
||||||
|
include: [
|
||||||
|
path.join(__dirname, '..', '..', 'src'),
|
||||||
|
path.join(__dirname, '..')
|
||||||
|
]
|
||||||
|
}]
|
||||||
|
},
|
||||||
optimization: {
|
optimization: {
|
||||||
runtimeChunk: {
|
runtimeChunk: {
|
||||||
name: 'common'
|
name: 'common'
|
||||||
|
|||||||
@@ -64,20 +64,20 @@ function createWordIndex(exampleData) {
|
|||||||
/**
|
/**
|
||||||
* Gets the source for the chunk that matches the jsPath
|
* Gets the source for the chunk that matches the jsPath
|
||||||
* @param {Object} chunk Chunk.
|
* @param {Object} chunk Chunk.
|
||||||
* @param {string} jsPath Path of the file.
|
* @param {string} jsName Name of the file.
|
||||||
* @return {string} The source.
|
* @return {string} The source.
|
||||||
*/
|
*/
|
||||||
function getJsSource(chunk, jsPath) {
|
function getJsSource(chunk, jsName) {
|
||||||
let jsSource;
|
let jsSource;
|
||||||
for (let i = 0, ii = chunk.modules.length; i < ii; ++i) {
|
for (let i = 0, ii = chunk.modules.length; i < ii; ++i) {
|
||||||
const module = chunk.modules[i];
|
const module = chunk.modules[i];
|
||||||
if (module.modules) {
|
if (module.modules) {
|
||||||
jsSource = getJsSource(module, jsPath);
|
jsSource = getJsSource(module, jsName);
|
||||||
if (jsSource) {
|
if (jsSource) {
|
||||||
return jsSource;
|
return jsSource;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (module.identifier == jsPath) {
|
if (module.identifier.endsWith(jsName)) {
|
||||||
return module.source;
|
return module.source;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -151,8 +151,7 @@ ExampleBuilder.prototype.render = async function(dir, chunk) {
|
|||||||
|
|
||||||
// add in script tag
|
// add in script tag
|
||||||
const jsName = `${name}.js`;
|
const jsName = `${name}.js`;
|
||||||
const jsPath = path.join(dir, jsName);
|
let jsSource = getJsSource(chunk, path.join('.', jsName));
|
||||||
let jsSource = getJsSource(chunk, jsPath);
|
|
||||||
jsSource = jsSource.replace(/'\.\.\/src\//g, '\'');
|
jsSource = jsSource.replace(/'\.\.\/src\//g, '\'');
|
||||||
if (data.cloak) {
|
if (data.cloak) {
|
||||||
for (const entry of data.cloak) {
|
for (const entry of data.cloak) {
|
||||||
|
|||||||
+3
-2
@@ -43,6 +43,7 @@
|
|||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"babel-core": "^6.26.3",
|
"babel-core": "^6.26.3",
|
||||||
"babel-plugin-jsdoc-closure": "1.5.1",
|
"babel-plugin-jsdoc-closure": "1.5.1",
|
||||||
|
"buble-loader": "^0.5.1",
|
||||||
"chaikin-smooth": "^1.0.4",
|
"chaikin-smooth": "^1.0.4",
|
||||||
"clean-css-cli": "4.1.11",
|
"clean-css-cli": "4.1.11",
|
||||||
"copy-webpack-plugin": "^4.4.1",
|
"copy-webpack-plugin": "^4.4.1",
|
||||||
@@ -82,8 +83,8 @@
|
|||||||
"uglifyjs-webpack-plugin": "^1.2.5",
|
"uglifyjs-webpack-plugin": "^1.2.5",
|
||||||
"url-polyfill": "^1.0.13",
|
"url-polyfill": "^1.0.13",
|
||||||
"walk": "^2.3.9",
|
"walk": "^2.3.9",
|
||||||
"webpack": "4.12.1",
|
"webpack": "4.15.1",
|
||||||
"webpack-cli": "^3.0.3",
|
"webpack-cli": "^3.0.8",
|
||||||
"webpack-dev-server": "^3.1.4"
|
"webpack-dev-server": "^3.1.4"
|
||||||
},
|
},
|
||||||
"eslintConfig": {
|
"eslintConfig": {
|
||||||
|
|||||||
Reference in New Issue
Block a user