-
Notifications
You must be signed in to change notification settings - Fork 4.7k
Closed
Description
- I confirm that this is a issue rather than a question.
Bug report
I am using the @vuepress/markdown-loader
package in another project.
This package requires @vuepress/shared-utils
.
The parseFrontmatter.ts
file requires the gray-matter
module which is not present in the package.json
of @vuepress/shared-utils
.
Version
$ npm list | grep -2 @vuepress/markdown-loader
└─┬ @vuepress/[email protected]
├─┬ @vuepress/[email protected]
│ ├─┬ @vuepress/[email protected]
Steps to reproduce
- Create a package that requires
@vuepress/markdown-loader
(e.g.npm install @vuepress/markdown-loader
) - Install webpack:
npm install webpack webpack-cli
- Add a Markdown file (e.g.
Example.md
) - Configure webpack to use the markdown file as entry and the the markdown-loader to compile it:
const path = require('path')
module.exports = {
entry: path.resolve(__dirname, 'Example.md'),
output: {
path: path.resolve(__dirname, 'dist'),
filename: 'file.js'
},
module: {
rules: [
{
test: /\.md$/,
use: [
{
loader: require.resolve('@vuepress/markdown-loader'),
options: {
sourceDir: path.resolve('chapters')
}
}
]
}
]
}
}
- Run webpack
What is expected?
The markdown loader compiles all Markdown files.
What is actually happening?
Webpack throws the following warnings:
WARNING in ./Example.md
Module build failed (from ../@vuepress/markdown-loader/index.js):
Error: Cannot find module 'gray-matter'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:603:15)
at Function.Module._load (internal/modules/cjs/loader.js:529:25)
at Module.require (internal/modules/cjs/loader.js:657:17)
at require (/path/to/project/node_modules/v8-compile-cache/v8-compile-cache.js:159:20)
at parseFrontmatter (/path/to/project/node_modules/@vuepress/shared-utils/lib/parseFrontmatter.js:2:18)
at Object.module.exports (/path/to/project/node_modules/@vuepress/markdown-loader/index.js:41:23)
@ ./ sync nonrecursive \.md$ ./Example.md
@ ./index.js
Other relevant information
- Your OS:
macOS
- Node.js version:
v11.6.0
- Browser version:
n/a
- Is this a global or local install?
local
- Which package manager did you use for the install?
npm
Metadata
Metadata
Assignees
Labels
No labels