-
-
Save LinusBorg/799441234d11564bd2f5e4563fb974d9 to your computer and use it in GitHub Desktop.
TypeScript, VueJS and JSX webpack configuration
This file contains hidden or 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
Show hidden characters
{ | |
"presets": [], | |
"plugins": ["transform-vue-jsx", "transform-es2015-modules-commonjs"] | |
} |
This file contains hidden or 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
npm i -S \ | |
@types/core-js \ | |
vue \ | |
typescript \ | |
ts-loader \ | |
webpack \ | |
babel \ | |
babel-core \ | |
babel-loader \ | |
babel-plugin-syntax-jsx \ | |
babel-plugin-transform-es2015-modules-commonjs \ | |
babel-plugin-transform-vue-jsx \ | |
babel-helper-vue-jsx-merge-props |
This file contains hidden or 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
{ | |
"compilerOptions": { | |
"jsx": "preserve", | |
"module": "commonjs", | |
"moduleResolution": "node", | |
"outDir": "bin/", | |
"sourceMap": true, | |
"removeComments": true, | |
"target": "es5" | |
}, | |
"include": [ | |
"src/**/*" | |
], | |
"files": [ | |
"src/app.tsx" | |
] | |
} |
This file contains hidden or 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
module.exports = { | |
entry: "./src/app.tsx", | |
output: { | |
filename: "bin/bundle.js" | |
}, | |
resolve: { | |
// Add '.ts' and '.tsx' as a resolvable extension. | |
extensions: ["", ".webpack.js", ".web.js", ".ts", ".tsx", ".js"] | |
}, | |
module: { | |
loaders: [ | |
// It's important to run 'babel' first this will avoid a compilation error | |
{ test: /\.tsx?$/, loader: "babel" }, | |
// Run ts loader to transform our typescript into JS | |
{ test: /\.tsx?$/, loader: "ts-loader" } | |
] | |
}, | |
// If you want to load 'vue' as an external, and not include it in your bundle | |
// simply add it to the array. | |
externals : [] | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment