mobilusoss / textlint-browser-runner

textlint for browser bundled with Japanese preset rules.
https://mobilusoss.github.io/textlint-browser-runner
MIT License
12 stars 1 forks source link

babel-plugin-static-fs #19

Closed georgeOsdDev closed 4 years ago

georgeOsdDev commented 4 years ago

Use babel-plugin-static-fs to bundle some rules using fs.

georgeOsdDev commented 4 years ago
georgeOsdDev commented 4 years ago

🆖 textlint-rule-ja-no-abusage 🆖 textlint-rule-ja-hiragana-fukushi ✅ textlint-rule-ja-hiragana-hojodoushi

$ npm run build:dev

> textlint-browser-runner@0.0.3 build:dev /Users/oshidatakeharu/Project/Mobilus/mobilusoss/textlint-browser-runner/packages/textlint-browser-runner
> webpack --mode=development --config webpack.development.config.js

Discovered new dependency: /Users/oshidatakeharu/Project/Mobilus/mobilusoss/textlint-browser-runner/packages/textlint-rule-preset-mobilus/node_modules/textlint-rule-ja-hiragana-hojodoushi/lib/../dict/hojodoushi.yml
Webpack Bundle Analyzer is started at http://127.0.0.1:8888
Use Ctrl+C to close it
Hash: 8df48cb92e8cf3ed1d13
Version: webpack 4.41.5
Time: 14789ms
Built at: 02/10/2020 4:35:12 PM
             Asset      Size    Chunks             Chunk Names
textlint.bundle.js  4.14 MiB  textlint  [emitted]  textlint
Entrypoint textlint = textlint.bundle.js
[0] ./util.inspect (ignored) 15 bytes {textlint} [built]
[../textlint-rule-preset-mobilus/lib/textlint-rule-preset-mobilus.js] 2.82 KiB {textlint} [built]
[../textlint-rule-preset-mobilus/node_modules/moment/locale sync recursive [/\\](ja(\.js)?|es(\.js)?|fr(\.js)?|zh-cn(\.js)?|zh-hk(\.js)?|zh-tw(\.js)?)$] ../textlint-rule-preset-mobilus/node_modules/moment/locale sync [/\\](ja(\.js)?|es(\.js)?|fr(\.js)?|zh-cn(\.js)?|zh-hk(\.js)?|zh-tw(\.js)?)$ 304 bytes {textlint} [optional] [built]
[./index.js] 74 bytes {textlint} [built]
[./lib/textlint-browser-runner.js] 2 KiB {textlint} [built]
[./node_modules/webpack/buildin/global.js] (webpack)/buildin/global.js 905 bytes {textlint} [built]
[./node_modules/webpack/buildin/module.js] (webpack)/buildin/module.js 552 bytes {textlint} [built]
    + 686 hidden modules

ERROR in ../textlint-rule-preset-mobilus/node_modules/prh/lib/index.js
Module build failed (from ./node_modules/babel-loader/lib/index.js):
Error: /Users/oshidatakeharu/Project/Mobilus/mobilusoss/textlint-browser-runner/packages/textlint-rule-preset-mobilus/node_modules/prh/lib/index.js: Not able to statically evaluate the expression(s) for babel-plugin-static-fs.
Try changing your source code to something that can be evaluated at build-time, e.g.
    const src = fs.readFileSync(__dirname + '/foo.txt', 'utf8');

    at evaluate (/Users/oshidatakeharu/Project/Mobilus/mobilusoss/textlint-browser-runner/packages/textlint-browser-runner/node_modules/babel-plugin-static-fs/lib/static-eval.js:117:15)
    at /Users/oshidatakeharu/Project/Mobilus/mobilusoss/textlint-browser-runner/packages/textlint-browser-runner/node_modules/babel-plugin-static-fs/lib/static-eval.js:70:16
    at Array.map (<anonymous>)
    at evaluate (/Users/oshidatakeharu/Project/Mobilus/mobilusoss/textlint-browser-runner/packages/textlint-browser-runner/node_modules/babel-plugin-static-fs/lib/static-eval.js:69:41)
    at evaluate (/Users/oshidatakeharu/Project/Mobilus/mobilusoss/textlint-browser-runner/packages/textlint-browser-runner/node_modules/babel-plugin-static-fs/index.js:111:12)
    at CallExpression (/Users/oshidatakeharu/Project/Mobilus/mobilusoss/textlint-browser-runner/packages/textlint-browser-runner/node_modules/babel-plugin-static-fs/index.js:130:13)
    at NodePath._call (/Users/oshidatakeharu/Project/Mobilus/mobilusoss/textlint-browser-runner/packages/textlint-browser-runner/node_modules/@babel/traverse/lib/path/context.js:55:20)
    at NodePath.call (/Users/oshidatakeharu/Project/Mobilus/mobilusoss/textlint-browser-runner/packages/textlint-browser-runner/node_modules/@babel/traverse/lib/path/context.js:42:17)
    at NodePath.visit (/Users/oshidatakeharu/Project/Mobilus/mobilusoss/textlint-browser-runner/packages/textlint-browser-runner/node_modules/@babel/traverse/lib/path/context.js:90:31)
    at TraversalContext.visitQueue (/Users/oshidatakeharu/Project/Mobilus/mobilusoss/textlint-browser-runner/packages/textlint-browser-runner/node_modules/@babel/traverse/lib/context.js:112:16)
    at TraversalContext.visitSingle (/Users/oshidatakeharu/Project/Mobilus/mobilusoss/textlint-browser-runner/packages/textlint-browser-runner/node_modules/@babel/traverse/lib/context.js:84:19)
    at TraversalContext.visit (/Users/oshidatakeharu/Project/Mobilus/mobilusoss/textlint-browser-runner/packages/textlint-browser-runner/node_modules/@babel/traverse/lib/context.js:140:19)
    at Function.traverse.node (/Users/oshidatakeharu/Project/Mobilus/mobilusoss/textlint-browser-runner/packages/textlint-browser-runner/node_modules/@babel/traverse/lib/index.js:84:17)
    at NodePath.visit (/Users/oshidatakeharu/Project/Mobilus/mobilusoss/textlint-browser-runner/packages/textlint-browser-runner/node_modules/@babel/traverse/lib/path/context.js:97:18)
    at TraversalContext.visitQueue (/Users/oshidatakeharu/Project/Mobilus/mobilusoss/textlint-browser-runner/packages/textlint-browser-runner/node_modules/@babel/traverse/lib/context.js:112:16)
    at TraversalContext.visitMultiple (/Users/oshidatakeharu/Project/Mobilus/mobilusoss/textlint-browser-runner/packages/textlint-browser-runner/node_modules/@babel/traverse/lib/context.js:79:17)
    at TraversalContext.visit (/Users/oshidatakeharu/Project/Mobilus/mobilusoss/textlint-browser-runner/packages/textlint-browser-runner/node_modules/@babel/traverse/lib/context.js:138:19)
    at Function.traverse.node (/Users/oshidatakeharu/Project/Mobilus/mobilusoss/textlint-browser-runner/packages/textlint-browser-runner/node_modules/@babel/traverse/lib/index.js:84:17)
    at NodePath.visit (/Users/oshidatakeharu/Project/Mobilus/mobilusoss/textlint-browser-runner/packages/textlint-browser-runner/node_modules/@babel/traverse/lib/path/context.js:97:18)
    at TraversalContext.visitQueue (/Users/oshidatakeharu/Project/Mobilus/mobilusoss/textlint-browser-runner/packages/textlint-browser-runner/node_modules/@babel/traverse/lib/context.js:112:16)
    at TraversalContext.visitMultiple (/Users/oshidatakeharu/Project/Mobilus/mobilusoss/textlint-browser-runner/packages/textlint-browser-runner/node_modules/@babel/traverse/lib/context.js:79:17)
    at TraversalContext.visit (/Users/oshidatakeharu/Project/Mobilus/mobilusoss/textlint-browser-runner/packages/textlint-browser-runner/node_modules/@babel/traverse/lib/context.js:138:19)
    at Function.traverse.node (/Users/oshidatakeharu/Project/Mobilus/mobilusoss/textlint-browser-runner/packages/textlint-browser-runner/node_modules/@babel/traverse/lib/index.js:84:17)
    at NodePath.visit (/Users/oshidatakeharu/Project/Mobilus/mobilusoss/textlint-browser-runner/packages/textlint-browser-runner/node_modules/@babel/traverse/lib/path/context.js:97:18)
    at TraversalContext.visitQueue (/Users/oshidatakeharu/Project/Mobilus/mobilusoss/textlint-browser-runner/packages/textlint-browser-runner/node_modules/@babel/traverse/lib/context.js:112:16)
    at TraversalContext.visitSingle (/Users/oshidatakeharu/Project/Mobilus/mobilusoss/textlint-browser-runner/packages/textlint-browser-runner/node_modules/@babel/traverse/lib/context.js:84:19)
    at TraversalContext.visit (/Users/oshidatakeharu/Project/Mobilus/mobilusoss/textlint-browser-runner/packages/textlint-browser-runner/node_modules/@babel/traverse/lib/context.js:140:19)
    at Function.traverse.node (/Users/oshidatakeharu/Project/Mobilus/mobilusoss/textlint-browser-runner/packages/textlint-browser-runner/node_modules/@babel/traverse/lib/index.js:84:17)
    at NodePath.visit (/Users/oshidatakeharu/Project/Mobilus/mobilusoss/textlint-browser-runner/packages/textlint-browser-runner/node_modules/@babel/traverse/lib/path/context.js:97:18)
    at TraversalContext.visitQueue (/Users/oshidatakeharu/Project/Mobilus/mobilusoss/textlint-browser-runner/packages/textlint-browser-runner/node_modules/@babel/traverse/lib/context.js:112:16)
 @ ../textlint-rule-preset-mobilus/node_modules/prh/index.js 1:17-34
 @ ../textlint-rule-preset-mobilus/node_modules/textlint-rule-prh/lib/textlint-rule-prh.js
 @ ../textlint-rule-preset-mobilus/node_modules/textlint-rule-ja-no-abusage/lib/textlint-rule-ja-no-abusage.js
 @ ../textlint-rule-preset-mobilus/lib/textlint-rule-preset-mobilus.js
 @ ./lib/textlint-browser-runner.js
 @ ./index.js

ERROR in ../textlint-rule-preset-mobilus/node_modules/textlint-rule-ja-hiragana-fukushi/lib/index.js
Module build failed (from ./node_modules/babel-loader/lib/index.js):
Error: /Users/oshidatakeharu/Project/Mobilus/mobilusoss/textlint-browser-runner/packages/textlint-rule-preset-mobilus/node_modules/textlint-rule-ja-hiragana-fukushi/lib/index.js: Not able to statically evaluate the expression(s) for babel-plugin-static-fs.
Try changing your source code to something that can be evaluated at build-time, e.g.
    const src = fs.readFileSync(__dirname + '/foo.txt', 'utf8');

    at evaluate (/Users/oshidatakeharu/Project/Mobilus/mobilusoss/textlint-browser-runner/packages/textlint-browser-runner/node_modules/babel-plugin-static-fs/lib/static-eval.js:117:15)
    at /Users/oshidatakeharu/Project/Mobilus/mobilusoss/textlint-browser-runner/packages/textlint-browser-runner/node_modules/babel-plugin-static-fs/lib/static-eval.js:70:16
    at Array.map (<anonymous>)
    at evaluate (/Users/oshidatakeharu/Project/Mobilus/mobilusoss/textlint-browser-runner/packages/textlint-browser-runner/node_modules/babel-plugin-static-fs/lib/static-eval.js:69:41)
    at /Users/oshidatakeharu/Project/Mobilus/mobilusoss/textlint-browser-runner/packages/textlint-browser-runner/node_modules/babel-plugin-static-fs/lib/static-eval.js:70:16
    at Array.map (<anonymous>)
    at evaluate (/Users/oshidatakeharu/Project/Mobilus/mobilusoss/textlint-browser-runner/packages/textlint-browser-runner/node_modules/babel-plugin-static-fs/lib/static-eval.js:69:41)
    at evaluate (/Users/oshidatakeharu/Project/Mobilus/mobilusoss/textlint-browser-runner/packages/textlint-browser-runner/node_modules/babel-plugin-static-fs/index.js:111:12)
    at CallExpression (/Users/oshidatakeharu/Project/Mobilus/mobilusoss/textlint-browser-runner/packages/textlint-browser-runner/node_modules/babel-plugin-static-fs/index.js:130:13)
    at NodePath._call (/Users/oshidatakeharu/Project/Mobilus/mobilusoss/textlint-browser-runner/packages/textlint-browser-runner/node_modules/@babel/traverse/lib/path/context.js:55:20)
    at NodePath.call (/Users/oshidatakeharu/Project/Mobilus/mobilusoss/textlint-browser-runner/packages/textlint-browser-runner/node_modules/@babel/traverse/lib/path/context.js:42:17)
    at NodePath.visit (/Users/oshidatakeharu/Project/Mobilus/mobilusoss/textlint-browser-runner/packages/textlint-browser-runner/node_modules/@babel/traverse/lib/path/context.js:90:31)
    at TraversalContext.visitQueue (/Users/oshidatakeharu/Project/Mobilus/mobilusoss/textlint-browser-runner/packages/textlint-browser-runner/node_modules/@babel/traverse/lib/context.js:112:16)
    at TraversalContext.visitMultiple (/Users/oshidatakeharu/Project/Mobilus/mobilusoss/textlint-browser-runner/packages/textlint-browser-runner/node_modules/@babel/traverse/lib/context.js:79:17)
    at TraversalContext.visit (/Users/oshidatakeharu/Project/Mobilus/mobilusoss/textlint-browser-runner/packages/textlint-browser-runner/node_modules/@babel/traverse/lib/context.js:138:19)
    at Function.traverse.node (/Users/oshidatakeharu/Project/Mobilus/mobilusoss/textlint-browser-runner/packages/textlint-browser-runner/node_modules/@babel/traverse/lib/index.js:84:17)
    at NodePath.visit (/Users/oshidatakeharu/Project/Mobilus/mobilusoss/textlint-browser-runner/packages/textlint-browser-runner/node_modules/@babel/traverse/lib/path/context.js:97:18)
    at TraversalContext.visitQueue (/Users/oshidatakeharu/Project/Mobilus/mobilusoss/textlint-browser-runner/packages/textlint-browser-runner/node_modules/@babel/traverse/lib/context.js:112:16)
    at TraversalContext.visitSingle (/Users/oshidatakeharu/Project/Mobilus/mobilusoss/textlint-browser-runner/packages/textlint-browser-runner/node_modules/@babel/traverse/lib/context.js:84:19)
    at TraversalContext.visit (/Users/oshidatakeharu/Project/Mobilus/mobilusoss/textlint-browser-runner/packages/textlint-browser-runner/node_modules/@babel/traverse/lib/context.js:140:19)
    at Function.traverse.node (/Users/oshidatakeharu/Project/Mobilus/mobilusoss/textlint-browser-runner/packages/textlint-browser-runner/node_modules/@babel/traverse/lib/index.js:84:17)
    at NodePath.visit (/Users/oshidatakeharu/Project/Mobilus/mobilusoss/textlint-browser-runner/packages/textlint-browser-runner/node_modules/@babel/traverse/lib/path/context.js:97:18)
    at TraversalContext.visitQueue (/Users/oshidatakeharu/Project/Mobilus/mobilusoss/textlint-browser-runner/packages/textlint-browser-runner/node_modules/@babel/traverse/lib/context.js:112:16)
    at TraversalContext.visitMultiple (/Users/oshidatakeharu/Project/Mobilus/mobilusoss/textlint-browser-runner/packages/textlint-browser-runner/node_modules/@babel/traverse/lib/context.js:79:17)
    at TraversalContext.visit (/Users/oshidatakeharu/Project/Mobilus/mobilusoss/textlint-browser-runner/packages/textlint-browser-runner/node_modules/@babel/traverse/lib/context.js:138:19)
    at Function.traverse.node (/Users/oshidatakeharu/Project/Mobilus/mobilusoss/textlint-browser-runner/packages/textlint-browser-runner/node_modules/@babel/traverse/lib/index.js:84:17)
    at NodePath.visit (/Users/oshidatakeharu/Project/Mobilus/mobilusoss/textlint-browser-runner/packages/textlint-browser-runner/node_modules/@babel/traverse/lib/path/context.js:97:18)
    at TraversalContext.visitQueue (/Users/oshidatakeharu/Project/Mobilus/mobilusoss/textlint-browser-runner/packages/textlint-browser-runner/node_modules/@babel/traverse/lib/context.js:112:16)
    at TraversalContext.visitMultiple (/Users/oshidatakeharu/Project/Mobilus/mobilusoss/textlint-browser-runner/packages/textlint-browser-runner/node_modules/@babel/traverse/lib/context.js:79:17)
    at TraversalContext.visit (/Users/oshidatakeharu/Project/Mobilus/mobilusoss/textlint-browser-runner/packages/textlint-browser-runner/node_modules/@babel/traverse/lib/context.js:138:19)
 @ ../textlint-rule-preset-mobilus/lib/textlint-rule-preset-mobilus.js 10:39-83
 @ ./lib/textlint-browser-runner.js
 @ ./index.js
georgeOsdDev commented 4 years ago

Done #23