Open FunCracker opened 7 years ago
It's not pretty but here is how I got around it:
copy.config.js
file:
var config = require('./node_modules/@ionic/app-scripts/config/copy.config.js');
config.copyJsonEditorCss = { src: './node_modules/jsoneditor/dist/jsoneditor.min.css', dest: '{{WWW}}/jsoneditor/' }; config.copyJsonEditorAssets = { src: './node_modules/jsoneditor/dist/img/jsoneditor-icons.svg', dest: '{{WWW}}/jsoneditor/img/' };
module.exports = config;
2. Install an `ignore-loader` for webpack:
```sh
$ npm install --save-dev ignore-loader
webpack.config.js
file:
var webpack = require('webpack');
var config = require('./node_modules/@ionic/app-scripts/config/webpack.config.js');
config.module.loaders.push({ test: /\jsoneditor-icons.svg$/, loader: 'ignore-loader' }); config.module.loaders.push({ test: /\jsoneditor.min.css/, loader: 'ignore-loader' });
module.exports = config;
4. In `src/index.html` manually add the `jsoneditor` css copied from above config:
```html
<link href="jsoneditor/jsoneditor.min.css" rel="stylesheet">
package.json
:
"config": {
"ionic_bundler": "webpack",
"ionic_webpack": "./webpack.config.js",
"ionic_copy": "./copy.config.js"
}
If anyone has a better way to do this, please shoot
Error when trying to import JSONEditorModule ERROR in ./~/jsoneditor/dist/jsoneditor.min.css Module parse failed: D:\project_code\working_copy\Web\node_modules\jsoneditor\dist\jsoneditor.min.css Unexpected token (1:35) You may need an appropriate loader to handle this file type. SyntaxError: Unexpected token (1:35) at Parser.pp$4.raise (D:\project_code\working_copy\Web\node_modules\webpack\node_modules\acorn\dist\acorn.js:2221:15) at Parser.pp.unexpected (D:\project_code\working_copy\Web\node_modules\webpack\node_modules\acorn\dist\acorn.js:603:10) at Parser.pp.semicolon (D:\project_code\working_copy\Web\node_modules\webpack\node_modules\acorn\dist\acorn.js:581:61) at Parser.pp$1.parseExpressionStatement (D:\project_code\working_copy\Web\node_modules\webpack\node_modules\acorn\dist\acorn.js:966:10) at Parser.pp$1.parseStatement (D:\project_code\working_copy\Web\node_modules\webpack\node_modules\acorn\dist\acorn.js:730:24) at Parser.pp$1.parseTopLevel (D:\project_code\working_copy\Web\node_modules\webpack\node_modules\acorn\dist\acorn.js:638:25) at Parser.parse (D:\project_code\working_copy\Web\node_modules\webpack\node_modules\acorn\dist\acorn.js:516:17) at Object.parse (D:\project_code\working_copy\Web\node_modules\webpack\node_modules\acorn\dist\acorn.js:3098:39) at Parser.parse (D:\project_code\working_copy\Web\node_modules\webpack\lib\Parser.js:902:15) at NormalModule. (D:\project_code\working_copy\Web\node_modules\webpack\lib\NormalModule.js:104:16)
at NormalModule.onModuleBuild (D:\project_code\working_copy\Web\node_modules\webpack-core\lib\NormalModuleMixin.js:310:10)
at nextLoader (D:\project_code\working_copy\Web\node_modules\webpack-core\lib\NormalModuleMixin.js:275:25)
at D:\project_code\working_copy\Web\node_modules\webpack-core\lib\NormalModuleMixin.js:259:5
at Storage.finished (D:\project_code\working_copy\Web\node_modules\webpack\node_modules\enhanced-resolve\lib\CachedInputFileSystem.js:38:16)
at D:\project_code\working_copy\Web\node_modules\graceful-fs\graceful-fs.js:78:16
at FSReqWrap.readFileAfterClose [as oncomplete] (fs.js:415:3)
@ ./~/ng2-jsoneditor/dist/jsoneditor.component.js 14:0-45
ERROR in ./~/ajv/lib/refs/json-schema-draft-04.json Module parse failed: D:\project_code\working_copy\Web\node_modules\ajv\lib\refs\json-schema-draft-04.json Unexpected token (2:8) You may need an appropriate loader to handle this file type. SyntaxError: Unexpected token (2:8) at Parser.pp$4.raise (D:\project_code\working_copy\Web\node_modules\webpack\node_modules\acorn\dist\acorn.js:2221:15) at Parser.pp.unexpected (D:\project_code\working_copy\Web\node_modules\webpack\node_modules\acorn\dist\acorn.js:603:10) at Parser.pp.semicolon (D:\project_code\working_copy\Web\node_modules\webpack\node_modules\acorn\dist\acorn.js:581:61) at Parser.pp$1.parseExpressionStatement (D:\project_code\working_copy\Web\node_modules\webpack\node_modules\acorn\dist\acorn.js:966:10) at Parser.pp$1.parseStatement (D:\project_code\working_copy\Web\node_modules\webpack\node_modules\acorn\dist\acorn.js:730:24) at Parser.pp$1.parseBlock (D:\project_code\working_copy\Web\node_modules\webpack\node_modules\acorn\dist\acorn.js:981:25) at Parser.pp$1.parseStatement (D:\project_code\working_copy\Web\node_modules\webpack\node_modules\acorn\dist\acorn.js:709:33) at Parser.pp$1.parseTopLevel (D:\project_code\working_copy\Web\node_modules\webpack\node_modules\acorn\dist\acorn.js:638:25) at Parser.parse (D:\project_code\working_copy\Web\node_modules\webpack\node_modules\acorn\dist\acorn.js:516:17) at Object.parse (D:\project_code\working_copy\Web\node_modules\webpack\node_modules\acorn\dist\acorn.js:3098:39) at Parser.parse (D:\project_code\working_copy\Web\node_modules\webpack\lib\Parser.js:902:15) at NormalModule. (D:\project_code\working_copy\Web\node_modules\webpack\lib\NormalModule.js:104:16)
at NormalModule.onModuleBuild (D:\project_code\working_copy\Web\node_modules\webpack-core\lib\NormalModuleMixin.js:310:10)
at nextLoader (D:\project_code\working_copy\Web\node_modules\webpack-core\lib\NormalModuleMixin.js:275:25)
at D:\project_code\working_copy\Web\node_modules\webpack-core\lib\NormalModuleMixin.js:259:5
at Storage.finished (D:\project_code\working_copy\Web\node_modules\webpack\node_modules\enhanced-resolve\lib\CachedInputFileSystem.js:38:16)
@ ./~/ajv/lib/ajv.js 351:23-66
ERROR in ./~/ajv/lib/refs/json-schema-v5.json Module parse failed: D:\project_code\working_copy\Web\node_modules\ajv\lib\refs\json-schema-v5.json Unexpected token (2:8) You may need an appropriate loader to handle this file type. SyntaxError: Unexpected token (2:8) at Parser.pp$4.raise (D:\project_code\working_copy\Web\node_modules\webpack\node_modules\acorn\dist\acorn.js:2221:15) at Parser.pp.unexpected (D:\project_code\working_copy\Web\node_modules\webpack\node_modules\acorn\dist\acorn.js:603:10) at Parser.pp.semicolon (D:\project_code\working_copy\Web\node_modules\webpack\node_modules\acorn\dist\acorn.js:581:61) at Parser.pp$1.parseExpressionStatement (D:\project_code\working_copy\Web\node_modules\webpack\node_modules\acorn\dist\acorn.js:966:10) at Parser.pp$1.parseStatement (D:\project_code\working_copy\Web\node_modules\webpack\node_modules\acorn\dist\acorn.js:730:24) at Parser.pp$1.parseBlock (D:\project_code\working_copy\Web\node_modules\webpack\node_modules\acorn\dist\acorn.js:981:25) at Parser.pp$1.parseStatement (D:\project_code\working_copy\Web\node_modules\webpack\node_modules\acorn\dist\acorn.js:709:33) at Parser.pp$1.parseTopLevel (D:\project_code\working_copy\Web\node_modules\webpack\node_modules\acorn\dist\acorn.js:638:25) at Parser.parse (D:\project_code\working_copy\Web\node_modules\webpack\node_modules\acorn\dist\acorn.js:516:17) at Object.parse (D:\project_code\working_copy\Web\node_modules\webpack\node_modules\acorn\dist\acorn.js:3098:39) at Parser.parse (D:\project_code\working_copy\Web\node_modules\webpack\lib\Parser.js:902:15) at NormalModule. (D:\project_code\working_copy\Web\node_modules\webpack\lib\NormalModule.js:104:16)
at NormalModule.onModuleBuild (D:\project_code\working_copy\Web\node_modules\webpack-core\lib\NormalModuleMixin.js:310:10)
at nextLoader (D:\project_code\working_copy\Web\node_modules\webpack-core\lib\NormalModuleMixin.js:275:25)
at D:\project_code\working_copy\Web\node_modules\webpack-core\lib\NormalModuleMixin.js:259:5
at Storage.finished (D:\project_code\working_copy\Web\node_modules\webpack\node_modules\enhanced-resolve\lib\CachedInputFileSystem.js:38:16)
@ ./~/ajv/lib/v5.js 20:21-58